[TOC]
## 调用指定栏目名称:
~~~
{$CATEGORYS[栏目ID]['catname']} 调用指定栏目名称
{$CATEGORYS[栏目ID]['letter']} 调用指定栏目拼音
{$CATEGORYS[栏目ID]['url']} 调用指定栏目url
{$CATEGORYS[栏目ID]['image']} 调用指定栏目栏目图片
{$CATEGORYS[栏目ID]['description']} 调用指定栏目栏目描述
~~~
## 一级栏目调用
~~~
{pc:content action="category" catid="0" num="8" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li>
<a href="{$r[url]}" title="{$r[catname]}">
{$r[catname]}
</a>
</li>
{/loop}
{/pc}
~~~
## 一级栏目+二级栏目
~~~
<div class="xw navbox">
{pc:content action="category" catid="0" num="10" siteid="$siteid" order="listorder ASC"}
<ul class="inbk">
<li class="nli"><h3><a href="{APP_PATH}" class="home">返回首页</a></h3></li>
{loop $data $r}
<li class="nli">
<h3>{$r[catname]}</h3>
<ul class="sub-nav cf">
{pc:content action="category" catid="$r[arrchildid]" num="10" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
</ul>
</li>
{/loop}
</ul>
{/pc}
</div>
~~~
## 当前栏目
~~~
{if $catid==$r[catid]}
class="current"
something...
{/if}
~~~
## 在文章前显示文章分类名
~~~
{pc:content action="lists" catid="2" order="listorder DESC" num="14" }
<?php $TYPE = getcache('type_content','commons');?>
{loop $data $n $r}
<li>
{if $TYPE[$r[typeid]][name]}
<span>
[{$TYPE[$r[typeid]][name]}]
</span>
{/if}
<a href="{$r['url']}" title="{$r['title']}" target="_blank">
{str_cut($r[title],33,'')}
</a>
</li>
{/loop}
{/pc}
~~~
## 当前页面的栏目图片调用标签
~~~
{pc:content action="category" catid="$catid" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<img src="{thumb($r[image],90,0)}" width="90" height="60" alt="{$r[catname]}" />
{/loop}
{/pc}
~~~
## 下面是指定调用某个栏目的标签
~~~
{pc:content action="category" catid="这里填写要调用的栏目ID" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<img src="{thumb($r[image],90,0)}" width="90" height="60" alt="{$r[catname]}" />
{/loop}
{/pc}
~~~
## 在list.html或者二级栏目中怎么调用出来父栏目
~~~
{$CATEGORYS[$top_parentid][catname]} //顶级父栏目名称
{$CATEGORYS[$CAT[parentid]][catname]} //父栏目名称这个没有测试过。
{$CATEGORYS[$top_parentid][XXX]} //顶级父栏目的相关字段值
~~~
~~~
{pc:content action="category" catid="$parentid" num="25" siteid="$siteid" order="listorder ASC"} //这里需要注意的是父栏目的id是$parentid
<span>{$CATEGORYS[$top_parentid][catname]}</span>
{loop $data $r}
<a href="{$r[url]}">{$r[catname]}</a>
{/loop}
{/pc}
~~~
## 内容页show.html
~~~
{$CAT[catname]} //内容页所在栏目的名称
{$CATEGORYS[$top_parentid][catname]} //内容页顶级栏目的名称,和list.html一样
{$CATEGORYS[$CAT[parentid]][catname]} //父栏目名称。
~~~
~~~
{pc:content action="category" catid="$top_parentid" num="25" siteid="$siteid" order="listorder ASC"}
{loop $data $r}//这里需要注意的是父栏目的id是$top_parentid
<a href="{$r[url]}">{$r[catname]}</a>
{/loop}
/pc}
~~~
## 文章的数据由标题、发布时间、阅读数、评论数、缩略图、摘要、文章关键词标签Tag组成
~~~
{pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}
{loop $data $r}
{php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r[id])); $views = $_r[views]; }
{php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$catid.'-'.$r[id].'-'.$modelid));}
<div class="cmsyouunit">
<h1><a href="{$r[url]}" target="_blank" title="{$r[title]}">{$r[title]}</a></h1>
<h4>发表于<span class="ago">{date('Y-m-d H:i:s',$r[inputtime])}</span>|<span class="view_time">{if $views}{$views}次阅读{else}哇,这是崭新的文章!{/if}</span>|<span class="num_recom">{if $comment_total}{$comment_total}{else}0{/if}条评论</span></h4>
<dl>
<dt>{if $r[thumb]}<a href="{$r[url]}" target="_blank"><img src="{thumb($r[thumb],200,135)}" alt="{$r[title]}" /></a>{/if}</dt>
<dd>{str_cut(strip_tags($r[description]), 398)}</dd>
</dl>
<div class="tag">
{php $keywords = explode(' ',$r[keywords]);}
{loop $keywords $keyword}
<a href="{APP_PATH}index.php?m=content&c=tag&catid={$catid}&tag={urlencode($keyword)}" target="_blank">{$keyword}</a>
{/loop}
</div>
</div>
{/loop}
<div id="pages" class="text-c">{$pages}</div>
{/pc}
~~~