当前位置:首页 »“秋了秋”个人博客 » 网站建设 » 织梦(dede)网站模版开发常用标签

织梦(dede)网站模版开发常用标签

作者:秋了秋 发表时间:2015年08月05日

关键词调用标签: <meta name="keywords" content="{dede:field name='keywords'/}"> 描述调用标签:<meta name="description" content="{dede:field name='description' function='html2text(@me)'/}"> -------------------------------------------------------------------------------- 模板库路径调用标签: {dede:field name='templeturl'/} 对应为templets目录 模板路径调用标签:{dede:global.cfg_templets_skin/} 对应为templets下的具体模版位置目录 -------------------------------------------------------------------------------- 网站标题调用标签: {dede:global name='cfg_webname'/} -------------------------------------------------------------------------------- 栏目导航调用标签: <li><a href="/">首页</a></li> {dede:channel type='top' row='8' currentstyle="<li class='thisclass'><a href='~typelink~'>~typename~</a> </li>"} <li><a href='[field:typelink/]' target="_blank">[field:typename/]</a> </li> {/dede:channel} -------------------------------------------------------------------------------- 指定调用栏目标签: {dede:type typeid='ID'}<a href='[field:typelink/]'>[field:typename /]</a>{/dede:type} -------------------------------------------------------------------------------- 指定id文章调用标签: {dede:arclist idlist='32' channelid='6' typeid='5' addfields='price,trueprice,brand'}<a href="[field:arcurl/]">[field:image/]</a>[field:price/]{/dede:arclist}调用id为32的文章,channelid 是这个内容模型id,addfields是要调用的字段.typeid是指定栏目id -------------------------------------------------------------------------------- 数据库方法调用指定栏目内容:{dede:sql sql='Select content from dede_arctype where id=44'}[field:content function=@cn_substr(@me,700) ."......" /]{/dede:sql}

function=@cn_substr(@me,700) ."......" 附加条件,用于限定内容长度,超出用省略号代替 -------------------------------------------------------------------------------- 数据库方法调用指定普通文章内容:{dede:sql sql="SELECT body FROM `dede_addonarticle` where aid = 2"}[field:body/]{/dede:sql} -------------------------------------------------------------------------------- 频道栏目调用标签: {dede:channel type='self'}<li><a href='[field:typelink/]'>[field:typename/]</a></li>{/dede:channel} -------------------------------------------------------------------------------- 友情链接调用标签: {dede:flink row='24' linktype=2/} -------------------------------------------------------------------------------- 网站版权调用标签: {dede:global name='cfg_powerby'/} -------------------------------------------------------------------------------- 网站备案调用标签: {dede:global name='cfg_beian'/} -------------------------------------------------------------------------------- 当前栏目名称标签: {dede:field name='typename'/} -------------------------------------------------------------------------------- 当前位置调用标签: {dede:field name='position'/}

自定义分隔符包屑导航

{dede:field name='position' runphp='yes'} $tc=" > "; $tf=split($tc,@me); $tn=count($tf); for($iij=0;$iij<($tn-1);$iij++){ if($iij==($tn-2)){$tf[$iij]=strip_tags($tf[$iij]);} $tl=$tl.$tf[$iij]." &rarr; "; } @me=$tl; echo @me; {/dede:field} -------------------------------------------------------------------------------- 自定义搜索表单: <form name="formsearch" action="/plus/search.php" method="post"> <input type="text" class="form-control" name="q"> <button type="submit" class="btn btn-info btn-flat"> </form> 有了搜索表单还要搜索模版,模版名字为search.htm,在模版目录下新建这个文件,把展示搜索代码放进去{dede:list perpage='4'}{/dede:list} -------------------------------------------------------------------------------- 列表文章调用标签: {dede:list pagesize='8'}[field:imglink/][field:image/][field:pubdate function="MyDate('Y-m-d',@me)"/][field:arcurl/][field:title/][field:description function='cn_substr(@me,150)'/]...{/dede:list}分别对应调取缩略图链接、缩略图、发布时间、链接、标题、描述 -------------------------------------------------------------------------------- 栏目链接调用标签: [field:typelink function='str_replace("a ","a class=ulink ",@me)'/] -------------------------------------------------------------------------------- 作者链接调用标签: [field:writer /] -------------------------------------------------------------------------------- 列表评论调用标签: [field:postnum/] -------------------------------------------------------------------------------- 阅读全文调用标签: <a href="[field:arcurl/]">查阅全文...</a> -------------------------------------------------------------------------------- 发布时间调用标签: [field:pubdate function="GetDateTimeMK(@me)"/] -------------------------------------------------------------------------------- 列表分页调用标签: {dede:pagelist listsize='4' listitem='index,pre,pageno,next,end '/} -------------------------------------------------------------------------------- 文章标题调用标签: {dede:field name="title"/} -------------------------------------------------------------------------------- 文章来源调用标签: {dede:field name='source'/} -------------------------------------------------------------------------------- 文章作者调用标签: {dede:field name='writer' /} -------------------------------------------------------------------------------- 文章时间调用标签: {dede:field name='pubdate' function='GetDateMk(@me)'/} -------------------------------------------------------------------------------- 文章Tag调用标签: {dede:tag type='current'/} -------------------------------------------------------------------------------- 文章点击数调用标签: <script src="{dede:field name='phpurl'/}/count.php?view=yes&aid={dede:field name='id'/}&mid={dede:field name='mid'/}"></script> --------------------------------------------------------------------------------

列表点击数调用标签:<script src="/plus/count.php?view=yes&aid=[field:id/]&mid=1"></script> -------------------------------------------------------------------------------- 文章内容调用标签: {dede:field name='body'/}

栏目内容调用标签:{dede:field.content/} -------------------------------------------------------------------------------- 文章分页调用标签: {dede:pagebreak/}

-------------------------------------------------------------------------------- [<a href="{dede:field name='phpurl'/}/stow.php?arcID={dede:field name=ID/}">收藏</a>]

-------------------------------------------------------------------------------- [<a href="{dede:field name='phpurl'/}/recommend.php?arcID={dede:field name=ID/}">推荐</a>]

-------------------------------------------------------------------------------- [<a href="{dede:field name='phpurl'/}/feedback.php?arcID={dede:field name=ID/}">评论</a>]

-------------------------------------------------------------------------------- [<a href="#" onClick="window.print();">打印</a>][<a href="#" onClick="window.close();">关闭</a>] -------------------------------------------------------------------------------- 文章顶客次数标签: {dede:field name='digg'/} <a href="javascript:Digg('digg',{dede:field name='id'/});">顶一下</a> -------------------------------------------------------------------------------- 上一篇 下一篇标签: {dede:prenext get='pre'/}{dede:prenext get='next'/} -------------------------------------------------------------------------------- 头条推荐调用标签: {dede:arclist row=1 titlelen=24 orderby=pubdate att=2} <dt> [field:textlink/] <span>[field:description/]……</span> </dt> {/dede:arclist} -------------------------------------------------------------------------------- 最新文章调用标签: {dede:arclist row=8 titlelen=24 orderby=pubdate}<li>[field:textlink/]</li> {/dede:arclist} -------------------------------------------------------------------------------- 热关键字调用标签: {dede:hotwords num='5' subday='30'/} -------------------------------------------------------------------------------- 最新图文调用标签: {dede:arclist row=4 titlelen=20 orderby=pubdate type='image.' imgwidth='152' imgheight='98'} <dd><a href="[field:arcurl/]"><img src="[field:picname/]" alt="[field:title/]" ></a><span><a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a></span> </dd>{/dede:arclist} -------------------------------------------------------------------------------- 推荐文档调用标签: {dede:arclist type='commend' titlelen='40' row='10'} <li><a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a></li> {/dede:arclist} -------------------------------------------------------------------------------- 随机推荐调用标签: {dede:arclist type='commend' titlelen='26' orderby='rand' row='10'} <li><a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a></li> {/dede:arclist} -------------------------------------------------------------------------------- 热点文档调用标签: {dede:arclist orderby='click' titlelen='40' row='10'} <li><a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a></li> {/dede:arclist} -------------------------------------------------------------------------------- 相关文档调用标签: {dede:likeart titlelen='24' row='10'} <li><a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a></li> {/dede:likeart} -------------------------------------------------------------------------------- 调用图片链接标记: <a href="[field:arcurl/]"><img src="[field:picname/]" alt="[field:title/]" ></a> <a href='[field:arcurl /]'>[field:image/]</a> -------------------------------------------------------------------------------- 调用文字链接标记: <a href="[field:aucurl/]" title="[field:title/]">[field:title/]</a> <a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a> -------------------------------------------------------------------------------- 控制字数描述标记: [field:description function="cn_substr(@me,100)"/]... -------------------------------------------------------------------------------- 调用文章tags标记: {dede:tag type='current'/} -------------------------------------------------------------------------------- 文章关键字与描述: {dede:field name='keywords'/} {dede:field name='description' function='html2text(@me)'/} -------------------------------------------------------------------------------- 栏目介绍:{dede:field name='description' function='html2text(@me)'/} -------------------------------------------------------------------------------- 调用外部htm文件:{dede:include file='head.htm' ismake='yes'/} -------------------------------------------------------------------------------- 搜索文章调用标签:{dede:global name='keyword'/}"的搜索结果 - {dede:global name='cfg_webname'/} 搜索" {dede:global name='keyword'/}</span>" 的结果 -------------------------------------------------------------------------------- 递增序列号: [field:global name=autoindex/] -------------------------------------------------------------------------------- 列表隔5行加一行线: {dede:list pagesize='50'} <LI><a href="[field:arcurl /]" title="[field:title function='htmlspecialchars(@me)'/]" target=_blank>[field:title function="cn_substr(@me,48)"/]</a>[field:pubdate runphp='yes'] $a="<font color=red>".strftime('%m-%d',@me)."</font>"; $b=strftime('%m-%d',@me); $ntime = time(); $day3 = 3600 * 24; if(($ntime - @me) < $day3) @me = $a; else @me =$b; [/field:pubdate]<br> [field:global name=autoindex runphp="yes"] if(@me%5==0)@me="<hr />"; else @me=""; [/field:global] {/dede:list} <DIV class="line2 m1 m3"></DIV></LI> -------------------------------------------------------------------------------- 最新 文章列表 “隔行换色” 的方法 {dede:arclist orderby=pubdate titlelen='26' row='10'} [field:global runphp='yes' name=autoindex] $a="<div id='a'>"; $b="<div id='b'>"; if ((@me%2)==0) @me=$a; else @me=$b; [/field:global] <ul> <li>[field:title/]</li> </ul> </div> {/dede:arclist} -------------------------------------------------------------------------------- 24小时内更新的文章时间显示为红色: [field:pubdate runphp='yes'] $a="<font color=red>".strftime('%m-%d',@me)."</font>"; $b=strftime('%m-%d',@me); $ntime = time(); $day3 = 3600 * 24; if(($ntime - @me) < $day3) @me = $a; else @me =$b; [/field:pubdate] -------------------------------------------------------------------------------- COPY页面内容,自动在后面加上网站信息,利于SEO <script type="text/javascript"> document.body.oncopy = function () { setTimeout( function () { var text = clipboardData.getData("text"); if (text) { text = text + "rn本篇文章来源于 www.地址.COM 原文链接:"+location.href; clipboardData.setData("text", text); } }, 100 ) } </script> -------------------------------------------------------------------------------- 按时间点击文章排行榜调用标签: 按总: {dede:arclist row='24' titlelen=24 orderby=click} 按月: {dede:arclist row='24' titlelen=8 orderby=click subday=30} 按周: {dede:arclist row='24' titlelen=8 orderby=click subday=7} 在首页调用某栏目的子栏目 {dede:channel type=’sun’ typeid=’栏目ID’} <a href=”[field:typelink/]“>[field:typename/]</a> {/dede:channel} 或者 {dede:global name=’maplist’/} -------------------------------------------------------------------------------- 搜索表单调用标签: <form action="{dede:global name='cfg_phpurl'/}/search.php" name="formsearch"> <input type="hidden" name="kwtype" value="1" /> <input name="keyword" id="keyword" type="text" class="searchtxt" /> <select name="searchtype" id="searchtype"> <option value="titlekeyword" selected>智能模糊搜索</option> <option value="title">仅搜索标题</option> </select> <input type="image" src="{dede:field name='templeturl'/}/images/topsearch_submit.gif" /> </form> -------------------------------------------------------------------------------- 实现“文章标题-2级栏目-1级栏目-网站名”形式 {dede:field name='title'/}-{dede:field name='position' runphp='yes'} $tc="-"; //分隔符 $tw=$GLOBALS['cfg_list_symbol']; //调用位置分隔符 @me=html2text(@me); //去除html标签 $tf=split($tw,@me); //分解成数组 for($ta=(count($tf)-2);$ta>=1;$ta--){ //循环赋值给$tk $tk.=trim($tf[$ta]).$tc; } $tk=substr($tk,0,-1); @me=$tk; //赋值给@me {/dede:field}-{dede:global name='cfg_webname'/} -------------------------------------------------------------------------------- 调用缩略图: <img src='{dede:field name="litpic"/}'> -------------------------------------------------------------------------------- 发布的文章显示红色日期或加上new字或new小图片 给近三天(或当天)发布的文章显示红色日期或加上new字或new小图片等。 都是围绕pubdate做文章,写扩展的。 第2、3要注意的问题是:如:"<img src='new.gif' />中不能用双引号,否则不行。 如果要给当天的加,把 3600 * 24 * 3 改为 3600 * 24  即可。 1、==========红色的日期======== [field:pubdate runphp='yes'] $a="<font color=red>".strftime('%m-%d',@me)."</font>"; $b=strftime('%m-%d',@me); $ntime = time(); $day3 = 3600 * 24 * 3; if(($ntime - @me) < $day3) @me = $a; else @me =$b; [/field:pubdate] 2、==========红色的(new)======== [field:pubdate runphp='yes'] $aa=strftime('%m-%d',@me); $ntime = time(); $tagtime = @me; $day3 = 3600 * 24 * 3; if($tagtime > $ntime-$day3) @me = "<font color='red'>(new)</font>"; else @me = $aa; [/field:pubdate] 3、==========加new.gif小图片======== [field:pubdate runphp='yes'] $aa=strftime('%m-%d',@me); $ntime = time(); $tagtime = @me; $day3 = 3600 * 24 * 3; if($tagtime > $ntime-$day3) @me = "<img src='new.gif' />".$aa; else @me = $aa; [/field:pubdate] -------------------------------------------------------------------------------- 一种很酷的时间效果 [field:pubdate runphp="yes"] if((time()-@me)<(60*60*24)){@me=' <font color="#ff6600">'.strftime("%H:%M",@me).'</FONT>';} else {@me=strftime("%m-%d",@me);} [/field:pubdate] -------------------------------------------------------------------------------- DEDE seo小技巧加个百度搜索本篇文章 【<a href="javascript:" onclick='window.open("http://www.baidu.com/s?q1={dede:field name="title" /}&q2=&q3=&q4=&rn=10&lm=0&ct=1&ft=&q5=&amp;amp;q6=你的网址")' target="_top" title="在百度搜索“{dede:field name="title" /}”相关内容"><font color=red>在百度搜索更多繁体字</font></a>】 把你的网址改一下,不加http,或者 【<a href="javascript:" onclick='window.open("http://www.baidu.com/baidu?word={dede:field name="title" /}")' target="_top" title="在百度搜索“{dede:field name="title" /}”相关内容"><font color=red>搜索说说</font></a>】 -------------------------------------------------------------------------------- 调用tag: {dede:field name='keywords' runphp='yes' } if(!empty(@me)){ $kws = explode(' ',@me); @me = ""; foreach($kws as $k){ @me .= "<a href='/tag.php?/$k/'>$k</a> "; } @me= str_replace('+', ' ',trim(@me)); } {/dede:field}

------------------------------------------------------------------------------------

修改通用版权 找到include\common.inc.php文件,搜索$cfg_version,以下几行都可以随便修改,如: $cfg_version = '秋叶'; $cfg_soft_lang = 'utf-8'; $cfg_soft_public = 'base'; $cfg_softname = '秋叶网络博客后台管理系统'; $cfg_soft_enname = '秋叶网络博客'; $cfg_soft_devteam = '秋叶网络博客'; 这些版权信息都体现在后台以及提示信息框标题上 ------------------------------------------------------------------------------------ 栏目文章数统计 找到include/common.func.php文件,在最后增加以下代码: function dynamic_num($current_id){ global $dsql; $t_num = $dsql->GetOne("select count(*) as num from `dede_archives` where typeid='$current_id'"); if(is_array($t_num)){ return $t_num[num]; }else{ return "0" ; } } 然后在前台需要调用的地方放以下代码: 共有({dede:type}[field:id function="dynamic_num(@me)" /]{/dede:type} {dede:sql sql="SELECT count( * ) AS c FROM cmsxx_archives WHERE pubdate > UNIX_TIMESTAMP( CURDATE() ) "}[field:c/] {/dede:sql})篇文章

0
文章作者: “秋了秋”个人博客,本站鼓励原创。
转载请注明本文地址:http://netblog.cn/blog/376.html
目录: 网站建设标签: 织梦标签 24060次阅读

请求播放音乐,请点击播放

登 录
点击获取验证码
还没账号?点击这里