phpcms2008栏目页模板category.html与列表页模板list.html:在栏目下面还有子栏目的时候,这个栏目应用的是category模板,只有当栏目下没有子栏目的时候才用的是list模板.

  category模板里面的调用的两种方法:1种是官方的调用

{loop $arrchildid $cid $c}

{$c[catname]} {$c[url]} 一级栏目名称与链接

{tag_栏目页信息列表} 栏目文章信息tag标签

{/loop}

这里另加个控制loop循环次数的写法:

  1. {loop $arrchildid $cid $c} 
  2. {php $i++} 
  3. 里面是调用内容  
  4. {php if($i==4) break;} 
  5. {/loop} 

里面就是php写法.

第2种:可以实现自定义的很多种写法,很灵活:

  1. <?php $temp=$CATEGORY[$catid]['arrchildid']; $temp = substr($temp,3);?> //获取当前页面栏目的子栏目ID 
  2. {get sql="select * from phpcms_category where catid in ($temp)" return="v"
  3. <a href="{$CATEGORY[$v[catid]][url]}">{$CATEGORY[$v[catid]][catname]}</a> 
  4. <a href="{$v[url]}" >{$v[catname]}</a> //两种都是调用栏目名称与链接,只有细微差别,无关紧要. get标签里面还可以写get. 
  5. {get sql="select * from `phpcms_content` a,`phpcms_content_position` b where a.contentid=b.contentid and a.catid='$v[catid]' and b.posid=1 and status=99 order by a.inputtime desc" rows="1"
  6. <p>{str_cut($r[description],100,'...')}</p> 
  7. {/get} 
  8.  
  9. {/get} 

要注意一点是两个get标签嵌套时 一个get标签必须要有一个指定返回值,如return="v"这个可以自己任意指定.