关键字描述:模板 制作 专题 标签 " < 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}


#p#

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




{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 $descriptionlen}<br/><span class="tag_description">&nbsp;&nbsp;&nbsp;&nbsp;{$article[description]}</span>{/if}


</td>


<td>{if $datetype}[<span class="tag_date">{$article[adddate]}</span>]{/if}</td>


{if $i%$cols==($cols-1)}</tr>{/if}


{/loop}


</table>



{if $pages}


<div class="pages">{$pages}</div>


{/if} 或者设置css里面tag_date的属性为float:right



图片文章页面的标签模板也是如此,我们需要做的,基本上就是css的变化来控制效果,这就需要大家对于css有一个比较浅显的掌握,具体可以参考css手册,网上到处都是,指的说明的一点,css的简写仅仅支持IE,FF和opera尚不能全部支持!



2.专题模板的制作


专题页面的制作主要设计的页面有


special.html 专题首页


special_list.html 专题列表页


special_show.html专题内容页


tag_speciallist.html专题标签页


专题是相同类型的文章组成的一个合集,大家可以把他看做一个栏目,只不过这个栏目比较特殊,它属于一个频道多个栏目下相同主题的文章合集,他的模板制作和文章栏目页面的制作是一模一样的,只不过是概念你的不同罢了,大家不要被这个概念吓到了!



写到这里,

菠萝

教你做模板系列基本要完工了,剩下的模板中,官方在默认模板中都有了相应的提示文件,相信不是很难看懂


这个教程希望对大家做模板有一个启发,请大家牢牢记住这一点


phpcms的模板就是html代码+js+标签


只要大家灵活掌握标签的调用,那么一定会做出很多个性化的pp模板的!