织梦文章系统修改专题文章列表的模板的方法
<p><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>如果没有进行特别的设置,专题的文章列表显示默认是采用的default下面的article_spec.htm文件作为模板。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这个模板文件很简单,前面是该专题的一些信息,下面是分割线,分割线以下就是现实节点和节点文章的模块。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这个模块按理说应该是专题模板最重要的内容,可是只有下面几行: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#0000ff" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>{dede:field.note/} <br>
< /div> </font><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>实在是让人出乎意料-这让人怎么改啊,连html标签都看不到。虽然不满,但是既然用了dedecms,就只能这样了,也许作者是希望减少用户的工作量吧,可以理解。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>要灵活的修改这个页面显示节点文章的样式,我想到了两种办法: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>直接在浏览器显示该页面时查看html代码的方式。</strong><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'> </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>不管你后台是如何做的,显示在浏览器上的才是最终结果。所以我只需看你最终的html代码,查看用到了那些html元素,在将相关元素的css写在样式表里面。这里有点小技巧,用firefox的firebug可以很容易的完成这个工作,至于怎么用,这里就不讲解了,可以直接百度。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>节点名称 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>节点文章列表</strong><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'> </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>知道这个以后,修改样式应该不难了吧。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>虽然上诉的方法不麻烦,但是总觉得不灵活。那我们直接看源码,然后随意的修改吧。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>处理专题主题调用标签{dede:field.note/}的php文件是include/taglib/channel/specialtopic.lib.php. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>找到</span><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>ch_specialtopic()</font><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>函数的第五行 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>$tempStr = GetSysTemplets('channel_spec_note.htm'); </font><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>从这里可以看到</span><font color="#0000ff" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>channel_spec_note.htm</font><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这个文件决定了节点和节点文章的显示。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>channel_spec_note.htm文件放在系统模板文件里面templets/system/channel_spec_note.htm </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>打开该文件我们发现里面的html代码和在浏览器查看的几乎一模一样: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>~notename~ <br>
~spec_arclist~ </font><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在实际运行的时候notename会被替换成节点名,~spec_arclist~ </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>会被替换成节点文章超链接。~spec_arclist~其实是一个字符串:形如 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>文章超链接 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>找到这个文件可以修改除了li之外的所以html元素,但是li我们还是不能为其加上类和id。 </span></p>
頁:
[1]