学学习网 手机版

学学习网

学习路径: 学习首页 > 设计工具 > dreamweaver >

dedecms标签调用(3)

设置字体:
----------------------------------

$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 + "\r\n本篇文章来源于 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/]
{/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)."";
$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)";
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)<(606024)){@me='
<font color="#ff6600">'.strftime("%H:%M",@me).'</FONT>';}
else {@me=strftime("%m-%d",@me);}
----------------------------------
课程列表
重点难点
赞助链接