刘总 發表於 2023-8-21 00:00:00

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

<p>
<strong>phpcms标签模板及专题模板的制作</strong><br><br><span>1.标签模板的制作</span><br><span>前面我们已经讲到了每个频道模板的制作,但是我们只是插入对应的标签代码,如何做到显示的效果能个性化,满足自己的要求呢?,那么我们就要对自己的标签模板做个性化的设计</span><br><span>所有以tag_开头的模板</span><br><span>都是标签模板</span><br><span>以文章频道的模板为例</span><br><br><span>我们会看到</span><br><span>tag_articlelist.html 文章列表标签模板</span><br><span>tag_picarticle.html 图片文章标签模板</span><br><span>剩下的两个我们一般做模板的时候,如果自己对于js代码不是很理解的话,我们一般不会去动它,</span><br><span>打开文章列表标签模板</span><br><br><span>CODE: &lt;table width="100%" border="0" align="center" cellpadding="1" cellspacing="1"&gt;</span><br><span>{loop $articles $i $article}</span><br><span>{if $i%$cols==0} &lt;tr&gt; {/if}</span><br><span>&lt;td height="20" width="{$width}"&gt;</span><br><span>{$article} {if $showcatname}{$article}{/if} &lt;a href="{$article}" /&gt;
<span>{if $showhits}({$article}){/if}</span><br><span>{if $showauthor}[作者:{$article}]{/if}</span><br><span>{if $article}&amp;nbsp;&lt;a href="{PHPCMS_PATH}comment/?item=articleid&amp;itemid={$article}" target="_blank"&gt;&lt;span&gt;评&lt;/span&gt;&lt;/a&gt;{/if}</span><br><span>{if $datetype}[&lt;span&gt;{$article}&lt;/span&gt;]{/if}</span><br><span>{if $descriptionlen}&lt;br/&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{$article}&lt;/span&gt;{/if} </span><br><span>&lt;/td&gt;</span><br><span>{if $i%$cols==($cols-1)}&lt;/tr&gt;{/if}</span><br><span>{/loop}</span><br><span>&lt;/table&gt;</span><br><br><span>{if $pages}</span><br><span>&lt;div&gt;{$pages}&lt;/div&gt;</span><br><span>{/if} 这个里面</span><br><span>{loop $articles $i $article}是一个循环,我们要关注的就是这个循环里面的内容</span><br><span>{if $i%$cols==0} &lt;tr&gt; {/if} 我们在标签里面设定的参数,显示几列,根据这个来控制标签的显示</span><br><span>{$article} 文章的图片,显示精华,置顶,还是普通文章</span><br><span>{if $showcatname}{$article}{/if} 所属栏目</span><br><br><span>{$article} 文章路径</span><br><br><span>{$article} 文章标题</span><br><span>{if $showhits}({$article}){/if} 点击数</span><br><span>{if $showauthor}[作者:{$article}]{/if} 作者</span><br><span>{if $article} &lt;a href="{PHPCMS_PATH}comment/?item=articleid&amp;itemid={$article}" target="_blank"&gt;&lt;span&gt;评&lt;/span&gt;&lt;/a&gt;{/if} 评论连接</span><br><span>{if $datetype}[&lt;span&gt;{$article}&lt;/span&gt;]{/if} 添加时间</span><br><span>{if $descriptionlen}&lt;br/&gt;&lt;span&gt; {$article}&lt;/span&gt;{/if} 描述说明</span><br><br><span>如果我们要实现时间的靠右对齐,那么我们可以把这个模板改成</span><br><br><span>CODE: &lt;table width="100%" border="0" align="center" cellpadding="1" cellspacing="1"&gt;</span><br><span>{loop $articles $i $article}</span><br><span>&lt; article if /if &gt; class</span><br><br><br><span>{if $i%$cols==0} &lt;tr&gt; {/if}</span><br><span>&lt;td height="20" width="{$width}"&gt;</span><br><span>{$article} {if $showcatname}{$article}{/if} &lt;a href="{$article}" /&gt;
<span>{if $showhits}({$article}){/if}</span><br><span>{if $showauthor}[作者:{$article}]{/if}</span><br><span>{if $article}&amp;nbsp;&lt;a href="{PHPCMS_PATH}comment/?item=articleid&amp;itemid={$article}" target="_blank"&gt;&lt;span&gt;评&lt;/span&gt;&lt;/a&gt;{/if}</span><br><span>{if $descriptionlen}&lt;br/&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{$article}&lt;/span&gt;{/if} </span><br><span>&lt;/td&gt;</span><br><span>&lt;td&gt;{if $datetype}[&lt;span&gt;{$article}&lt;/span&gt;]{/if}&lt;/td&gt;</span><br><span>{if $i%$cols==($cols-1)}&lt;/tr&gt;{/if}</span><br><span>{/loop}</span><br><span>&lt;/table&gt;</span><br><br><span>{if $pages}</span><br><span>&lt;div&gt;{$pages}&lt;/div&gt;</span><br><span>{/if} 或者设置css里面tag_date的属性为float:right</span><br><br><span>图片文章页面的标签模板也是如此,我们需要做的,基本上就是css的变化来控制效果,这就需要大家对于css有一个比较浅显的掌握,具体可以参考css手册,网上到处都是,指的说明的一点,css的简写仅仅支持IE,FF和opera尚不能全部支持!</span><br><br><span>2.专题模板的制作</span><br><span>专题页面的制作主要设计的页面有</span><br><span>special.html 专题首页</span><br><span>special_list.html 专题列表页</span><br><span>special_show.html专题内容页</span><br><span>tag_speciallist.html专题标签页</span><br><span>专题是相同类型的文章组成的一个合集,大家可以把他看做一个栏目,只不过这个栏目比较特殊,它属于一个频道多个栏目下相同主题的文章合集,他的模板制作和文章栏目页面的制作是一模一样的,只不过是概念你的不同罢了,大家不要被这个概念吓到了!</span><br><br><span>写到这里,</span><u><strong>菠萝</strong></u><span>教你做模板系列基本要完工了,剩下的模板中,官方在默认模板中都有了相应的提示文件,相信不是很难看懂</span><br><span>这个教程希望对大家做模板有一个启发,请大家牢牢记住这一点</span><br><span>phpcms的模板就是html代码+js+标签</span><br><span>只要大家灵活掌握标签的调用,那么一定会做出很多个性化的pp模板的!</span></span></span></p>
頁: [1]
查看完整版本: phpcms标签模板及专题模板的制作