phpcms标签模板及专题模板的制作


关键字描述:模板 制作 专题 标签 " < article if /if > class

phpcms标签模板及专题模板的制作

1.标签模板的制作
前面我们已经讲到了每个频道模板的制作,但是我们只是插入对应的标签代码,如何做到显示的效果能个性化,满足自己的要求呢?,那么我们就要对自己的标签模板做个性化的设计
所有以tag_开头的模板
都是标签模板
以文章频道的模板为例

我们会看到
tag_articlelist.html 文章列表标签模板
tag_picarticle.html 图片文章标签模板
剩下的两个我们一般做模板的时候,如果自己对于js代码不是很理解的话,我们一般不会去动它,
打开文章列表标签模板

CODE: [Copy to clipboard] <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
{loop $articles $i $article}
{if $i%$cols==0} <tr> {/if}
<td height="20" width="{$width}">
{$article[img]} {if $showcatname}{$article[catname]}{/if} <a href="{$article[url]}" title="{$article[alt]}" target="{$target}" class="tag_title_link">{$article[title]}</a>
{if $showhits}({$article[hits]}){/if}
{if $showauthor}[作者:{$article[author]}]{/if}
{if $article[showcommentlink]}&nbsp;<a href="{PHPCMS_PATH}comment/?item=articleid&itemid={$article[articleid]}" target="_blank"><span class="color_red">评</span></a>{/if}
{if $datetype}[<span class="tag_date">{$article[adddate]}</span>]{/if}
{if $descriptionlen}<br/><span class="tag_description">&nbsp;&nbsp;&nbsp;&nbsp;{$article[description]}</span>{/if}
</td>
{if $i%$cols==($cols-1)}</tr>{/if}
{/loop}
</table>

{if $pages}
<div class="pages">{$pages}</div>
{/if} 这个里面
{loop $articles $i $article}是一个循环,我们要关注的就是这个循环里面的内容
{if $i%$cols==0} <tr> {/if} 我们在标签里面设定的参数,显示几列,根据这个来控制标签的显示
{$article[img]} 文章的图片,显示精华,置顶,还是普通文章
{if $showcatname}{$article[catname]}{/if} 所属栏目

{$article[url]} 文章路径

{$article[title]} 文章标题
{if $showhits}({$article[hits]}){/if} 点击数
{if $showauthor}[作者:{$article[author]}]{/if} 作者
{if $article[showcommentlink]} <a href="{PHPCMS_PATH}comment/?item=articleid&itemid={$article[articleid]}" target="_blank"><span class="color_red">评</span></a>{/if} 评论连接
{if $datetype}[<span class="tag_date">{$article[adddate]}</span>]{/if} 添加时间
{if $descriptionlen}<br/><span class="tag_description"> {$article[description]}</span>{/if} 描述说明

如果我们要实现时间的靠右对齐,那么我们可以把这个模板改成

CODE: [Copy to clipboard] <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
{loop $articles $i $article}


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3