1.截取调用标题长度
{str_cut($r[title],36,'')}2.格式化时间
调用格式化时间 2011-05-06 11:22:33
{date('Y-m-d H:i:s',$r[inputtime])}3.多栏目调用&多推荐位调用
调用需求:文章范围为59 60 61三个栏目,并且推送到了27 和28两个推荐位;
从第三条开始,连续调用7篇文章。
{pc:get sql="SELECT * FROM v9_news WHERE id IN (SELECT id FROM v9_position_data WHERE posid in(27,28) and catid in(59,60,61)) order by listorder DESC" cache="3600" start="3" num="7" return="data" }
{loop $data $n $r}
·{str_cut($r[title],22,'')}
{/loop}
{/pc}
4.显示栏目名称(只是名称,不带链接)
{$catname}
显示栏目名称和链接(可以点击)
{$CATEGORYS[$r['catid']]['catname']}
{pc:get sql="SELECT * FROM cq_member where mtype='企业' " cache="3600" dbsource="dedecmsdb" num="7" return="data"}
{loop $data $r}
{str_cut($r[uname],28,'')}
{/loop}
{/pc}
{pc:content action="category" catid="$catid" num="25" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
{$r[catname]} |
{/loop}
{/pc}
8.显示指定id的栏目名称 (例子这里catid=22)
{$CATEGORYS[22]['catname']}{pc:content action="lists" catid="79" order="listorder DESC" num="14" }
{loop $data $n $r}
{if $TYPE[$r[typeid]][name]}[ {$TYPE[$r[typeid]][name]}] {/if}{str_cut($r[title],33,'')}
{/loop}
{/pc}
{pc:content action="lists" catid="66" order="listorder DESC" thumb="1" num="5" }
{php $num = 0}
{loop $data $r}
linkarr[{$num}] = "{$r[url]}";
picarr[{$num}] = "{$r[thumb]}";
textarr[{$num}] = "{str_cut($r[title],36,'')}";
{php $num++}
{/loop}
{/pc}
{pc:content action="position" posid="36" num="1" order="listorder DESC limit 1,1--" }
{pc:content action="position" posid="31" order="listorder DESC" limit='1,8--'}
{loop $data $r}
{str_cut($r[title],36,'')}
{/loop}
{/pc}
{pc:content action="position" posid="27" order="listorder DESC" num="3" start="5"}
{loop $data $r}
{str_cut($r[description],115)}...
{/loop}
{/pc}
{pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}
{loop $data $r}
{$r[title]}
{php $keywords = explode(',',$r[keywords]);}
文章标签:
{loop $keywords $keyword}
{$keyword}
{/loop}
{/loop}
{/pc}
{pc:content action="position" posid="8" order="listorder DESC" num="2"}
{loop $data $r}
{str_cut($r[title],26,'')}{if $n%2==1} |{/if}
{/loop}
{/pc}
{pc:content action="lists" catid="$catid" num="25" order="id DESC" page="$page" moreinfo="1"}
{loop $data $r}
[{$r['字段名']}]> {$r[title]}
{/loop}
{/pc}
{php $arrchildid = $CATEGORYS[$CAT[parentid]][arrchildid]}
{pc:get sql="SELECT * FROM v9_news where catid in($arrchildid) cache="3600" page="$page" num="12" return="data"}
17.V9表单功能 提交之后如何返回当前页面,而不是默认的首页文件地址
找到 phpcms\modules\formguide\index.php文件第73行showmessage(L('thanks'), APP_PATH);
修改成 如下代码即可实现自动返回前一页showmessage(L('thanks'), HTTP_REFERER);
{pc:content action="lists" moreinfo=1 catid="2" order="id DESC" num="4"}
{loop $data $key $val}
- {$val['title']}
价格:{str_cut($v['自定义段'],100)} //100 是字数
{/loop}
{/pc}
{pc:content action="position" posid="推荐位id" num="30" thumb="1" moreinfo="1" order="listorder DESC"}
{loop $data $key $val}
{str_cut($val['title'],20)}
{/loop}
{/pc}
20.编辑器上传图片自动使用标题作为alt参数
一: 修改 statics/js/ckeditor/plugins/image/dialogs/image.js二: 清除浏览器缓存
21.增加文章的随机点击数phpcms\modules\block\templates\search_content.tpl.php
13行改成
22、PHPCMS V9的get标签调用
1、调用本系统单条数据,示例(调用ID为1的信息,标题长度不超过25个汉字,显示更新日期):
- {$r[comments]}人参与评论·{str_cut($r[title], 28)}
{pc:get sql="SELECT * FROM `XX` WHERE fid =$ltid AND digest =2 AND ifupload =1 ORDER BY tid DESC" num="2" cache= "3600" return="data" }
{loop $data $r}
。。。。。
{/loop}
{/pc}
{ pc : get sql = "SELECT * FROM phpcms_member" cache = "3600" page = "$page" dbsource = "discuz" return = "data" }
{ loop $data $key $val }
{ $val [ username ]}< br />
{ /loop}
ul >
{ $pages }
{/ pc }