今天总结了一些phpcms常用的标签,方便大家以后忘记了点看就可以查看。
头部:
{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}
常用系统常量: {CSS_PATH} {JS_PATH} {IMG_PATH} {APP_PATH}//程序目录
模板包含:{template "content","header"} {template "content","sidebar"} {template "content","footer"}
------常用调用数据-------
{pc:content action="lists" catid="6" num="8" order="inputtime DESC" } {loop $data $r}
常用标签:{$r[thumb]}
推荐位调用:
{pc:content action="position" posid="1" order="listorder DESC" num="5"} {loop $data $r}
一级栏目调用:
{pc:content action="category" catid="0" num="8" siteid="$siteid" order="listorder ASC"} {loop $data $r}
在文章前显示文章分类名:
{pc:content action="lists" catid="2" order="listorder DESC" num="14" } {loop $data $n $r}
指定变量循环增长:
{pc:content... {php $num = 0} {loop $data $r} ... {php $num++} {/loop} {/pc}
文章从指定位置调用:num="3" start="5"} (可配合pc:get标签使用)
文章列表页调用关键字,或者首页调用关键字:
{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}
当列表几行的时候出现一次某些符号:{if $n%2==1}|{/if}
-------------------列表页调用-------------------------
当前位置显示:
class="postion">当前位置:首页 > {catpos($catid)} 列表
当前栏目名称:{$catname}
获取父栏目id/获取父栏目名称:{$CATEGORY[$catid][parentid]} / {$CATEGORYS[$CAT[parentid]][catname]}
指定ID栏目名称:{$CATEGORYS[栏目ID号]['catname']} / {$CATEGORYS[$catid]['catname']}
其他常用调用:{$r[description]} {$r[image]}
列表内容显示(带分页):
{pc:content action="lists" catid="$catid" num="20" order="id DESC" page="$page"} {loop $data $r}
- {date('Y-m-d H:i:s',$r[inputtime])}{$r[title]}
{/loop}{$pages}{/pc}
显示该栏目下的子栏目:
{if $top_parentid} {pc:content action="category" catid="$top_parentid" num="15" siteid="$siteid" order="listorder ASC"} {loop $data $r}
如果栏目下边没有子类,那么显示一级分类
{pc:content action="category" catid="0" num="100" siteid="$siteid" order="listorder ASC"} {loop $data $r}
频道页:
{php $j=1;} {loop subcat($catid) $v} {php if($v['type']!=0) continue;}更多»{$v[catname]}{$j++} {/loop}{pc:content action="lists" catid="$v[catid]" num="5" order="id DESC"} {loop $data $r}
- {date('Y-m-d',$r[inputtime])}{$r[title]}
{/loop} {/pc}
---------------------文章内容页-------------------
显示内容:
{$title} {$inputtime} {$content} {$copyfrom} {$thumb} 当前所属栏目:{$CAT[catname]} 当前所属栏目URL:{$CAT[url]}
获取多文件类型的上传的第一个文件地址:{php eval("\$arr=" . $r[upload] . ";");echo $arr[0]['fileurl'];}
父栏目名称与链接:{$CATEGORYS[$CAT[parentid]][catname]} 与 {$CATEGORYS[$CAT[parentid]][url]}
获取上上级栏目名称与链接:{$CATEGORYS[$CATEGORYS[$CAT[p
arentid]][parentid]][catname]} 与 {$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][url]}
组图列表:
{loop $photos $r}
浏览次数:
次
显示上一页和下一页:
文章内容分页:
加载评论:
{if $allow_comment && module_exists('comment')} {/if}
-----------PC:get语句调用数据---------------
用pc:get时的记录条数时分页显示:
解决办法一: {pc:get sql="SELECT title,url FROM v9_news where catid=9 and status=99 order by updatetime desc" start="0" num="4" return="v"} 解决办法二: {pc:get sql="SELECT title,url FROM v9_news where catid=9 and status=99 order by updatetime desc limit 0,4--" return="v"} 在首页某模型所有栏目最新文章调用带栏目名称 {pc:get sql="select * from v9_convert_news where status=99 order by id desc" num="11"} {loop $data $v}
---------------------友情链接-----------------------------------------------------------------------
{pc:link action="type_list" typeid="0" siteid="1" linktype="1" order="listorder DESC" num="8"} {loop $data $v} {$v['name']} {/loop} {/pc}
一般常用标题: {$v['url']} {$v['url']} {$v['logo']}
注:linktype="1"时为图片友情。为0时为文本链接
--------------调用单页内容-------------------------------
{pc:get sql="SELECT content FROM v9_page where catid='6'" return="data"} {loop $data $r} {str_cut(strip_tags($r[content]), 160)} {/loop} {/pc}
---------------调用排行-----------------
{pc:content action="hits" catid="13" order="weekviews DESC" num="4"} {loop $data $r}
统计:{tjcode()}
碎片:{pc:block pos="scroll"}{/pc}