应用phpcms建立企业站替换总结

首先是首页命名为index,在首页导航栏显示的一级栏目,点击一级栏目进入的是栏目首页,命名用category打头。点击一级栏目下的二级栏目进入的是栏目列表页,命名用lists打头。点击栏目列表页之中的内容进入的是内容页,命名用show来打头。二级栏目是建在一级栏目下的子栏目,而内容是建在二级栏目的文章中。

在替换时首页导航栏的替换:

{pc:content action="category" catid="0" num="4" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<div class="login-1"><a href="{$r[url]}" class=" xx xuanzhong">{$r[catname]}</a></div>
{/loop}
{/pc}

content表示内容,category表示栏目,一级栏目调用catid取0,{$r[url]}表示连接到栏目首页,{$r[catname]}为栏目名,{$CATEGORYS[$catid][image]}为单独调用栏目图片

二级栏目的替换:

{pc:content action="category" catid="$top_parentid" num="5" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<a href="{$r[url]}"><div class="liebiaoc-1">{$r[catname]}</div></a>
{/loop}
{/pc}

$top_parentid为顶级栏目id,单独调用可以将具体栏目的catid写上,{$r[url]}连接到的是列表页

列表页的替换:

{pc:content action="lists" catid="$catid" num="3" siteid="$siteid" order="catid ASC" moreinfo="1"}
{loop $data $r}
<div>
<a href="{$r[url]}"><div style="float: left;width: 210px;height: 140px;"><img src="{$r[thumb]}" style="width: 210px;height: 140px;"/></div>
<div style="float: left;height: 140px;width: 580px; margin-left: 20px;color: black;">
<div style="font-size: 24px;padding-bottom: 10px;">{$r[title]}</div>
{$r[description]}<br />
<div style="margin-top: 10px;">{date("Y-m-d",$r[updatetime])}</div>
</div>
</div></a>
<div style="clear: both;height:30px;"> </div>
{/loop}
{/pc}

lists表示调用文章,catid为文章所属栏目的catid,order表示排序, moreinfo="1"表示显示全部

{$r[url]}表示链接到内容页,{$r[thumb]}表示文章上传的图片,{$r[title]}表示文章的标题,{$r[description]}表示文章的摘要,{date("Y-m-d",$r[updatetime])}表示的修改时间,{$r[conent]}表示文章的内容。

单独调用:

{$CATEGORYS[$top_parentid][catname]} 顶级栏目名

{$CAT[catname]} 父级栏目名

posted @ 2017-10-29 15:21  傻糊糊  阅读(257)  评论(0编辑  收藏  举报