首页 > 其他 > 详细

DEDE 仿站模板简谈

时间:2014-03-09 00:52:00      阅读:615      评论:0      收藏:0      [点我收藏+]

1.主页模板

常用组合方法:index.htm + head.htm + footer.htm

嵌套语句:{dede:include filename="head.htm"/}

head.htm :网站头部(顶部+导航栏),所以也可继续拆分。一般顶部内容为从body后开始至导航栏。

bubuko.com,布布扣
导航栏 (自动获取栏目信息)
<div id="navtabs">
        <a href="{dede:global.cfg_cmsurl/}/" class="current">首页</a>
    {dede:channel type=‘top‘ row=‘10‘ currentstyle="<a href=‘~typelink~‘ >~typename~</a>"}
       <a href=‘[field:typeurl/]‘ >[field:typename/]</a>
       {/dede:channel}
</div>

二级栏目:直接指定所有二级链接,原网站都有js控制,直接拿来用就行
bubuko.com,布布扣

footer.htm:网站底部,包含版权信息,具体看实际的布局,大部分网站的友情链接作为独立模块在底部,包含进来更方便。

首页调用文章列表的方法,通过标签进行嵌套就行

示例:

bubuko.com,布布扣
{dede:arclist row=‘9‘ typeid=‘2‘ infolen=‘300‘}
<li>
<div class="ntitle f_l">
·<a href="[field:arcurl/]" class="hei" title="[field:fulltitle/]" target="_blank">[field:fulltitle  function=‘cn_substr(@me,80)‘/]</a>
</div>
<div class="ndate f_r"><a href="[field:arcurl/]" class="hui" target="_blank">[field:pubdate function="MyDate(‘Y-m-d‘,@me)"/]</a>
</div>
</li>
{/dede:arclist}
bubuko.com,布布扣

效果:

bubuko.com,布布扣

2.文章列表页

栏目名称:{dede:field name=‘typename‘ /}

获取顶级栏目下的所有栏目:

bubuko.com,布布扣
{dede:channel type=son typeid=1}
<li>
<a href="[field:typelink/]" title="[field:typename/]" style="color:#003366;background-position:-46px -78px;">[field:typename/]</a>
</li>
{/dede:channel}
bubuko.com,布布扣

获取栏目下的文章分页列表

bubuko.com,布布扣
{dede:list pagesize=5}
<li>
<div class=fleft>
<h1>
<a href="[field:arcurl/]" title=[field:title/]>·[field:title/]</a>
<span class=addtime>[field:pubdate function=strftime("%Y-%m-%d",@me)/]</span>  <img src="/images/public/hot06.gif">
</h1>
<p>
       [field:body function=cn_substr(html2text(@me),350)/]...
 </p>
</div>
    <a href="[field:arcurl/]" title=[field:title/] class=a>查看详情 >>></a><div class=clearfix>
</div>
</li>
{/dede:list}
bubuko.com,布布扣

分页

bubuko.com,布布扣
<style type=‘text/css‘>
.pagelist{padding-top: 10px;padding-bottom: 10px; text-align: center;}
.pagelist li{  display: inline;  line-height: 22px;}
.pagelist li a{margin-right: 5px;padding-right: 5px;padding-left: 5px;padding-top: 3px;padding-bottom: 3px;border: 1px solid #CCC;
         background-color: #FFF;}
.thisclass {font-weight: bold;color: #C00;}
</style>

<ul class="pagelist"> {dede:pagelist listitem="info,index,end,pre,next,pageno" listsize="5"/} </ul>
bubuko.com,布布扣

效果:

bubuko.com,布布扣

3.文章内容页

文章标题:{dede:field.title/}

网站名称:{dede:global.cfg_webname/}

标签:

bubuko.com,布布扣
 <div class="singleout">
            <div class="singlein">
                <div class="news_show">
                    <h1 style="color:#003366;">{dede:field.title/}</h1>
                    <h2 style="border-top:#663300 1px dashed;color:#666666;">
发布者:{dede:field.writer/}
发布时间:{dede:field.pubdate function="MyDate(‘Y-m-d‘,@me)"/}    
点击:<script src="{dede:field name=‘phpurl‘/}/count.php?view=yes&aid={dede:field name=‘id‘/}&mid={dede:field name=‘mid‘/}" type=text/javascript language="javascript"></script>次
            </h2> <div class="showcontent">
                {dede:field.body/}
            </div> </div> </div> </div>
bubuko.com,布布扣

DEDE 仿站模板简谈,布布扣,bubuko.com

DEDE 仿站模板简谈

原文:http://www.cnblogs.com/cncz/p/3588812.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!