[field:pubdate runphp='yes']...[/field :pubdate]" and save it."/> [field:pubdate runphp='yes']...[/field :pubdate]" and save it.">
Home > Article > CMS Tutorial > How to make the title of Dreamweaver's latest post appear red within 24 hours
#How to make the title of Dreamweaver’s latest post appear red within 24 hours?
The title of the latest post published by Dream Weaver DEDECMS is displayed in red within 24 hours
Recommended learning: Dream Weaver cms
How to modify DEDECMS The latest published content will be displayed in red within 24 hours. What about changing to the normal setting color after more than 24 hours? We all know that the latest published call tag is in the home page template of the template directory. We open templets/default/index.htm. Let's assume that the following code is the latest published tag that calls this site:
<dl class="list2"> <dt><b>最新发表</b></dt> {dede:arclist titlelen='60' noflag='h' row='13'} <dd><ul> <li><span>[field:pubdate function="MyDate('m-d',@me)"/]</span><a href="[field:arcurl/]"> [field:title/]</a></li> </ul></dd> {/dede:arclist} </dl>
The following code is the call tag with a red title within 24 hours after we modify it:
<dl class="list2"> <dt><b>最新发表</b></dt> {dede:arclist titlelen='60' noflag='h' row='13'} <dd><ul> <li><span>[field:pubdate runphp='yes'] $a="<font color='#ff0000'>"; $d="<font color='#858585'>"; $b="</font>"; $c=strftime("%m-%d","@me"); $ntime = time(); $oneday = 3600 * 24; if(($ntime - @me)<$oneday) @me = $a.$c.$b; else @me = $d.$c.$b; [/field:pubdate] </span><a href="[field:arcurl/]">[field:title/]</a></li> </ul></dd> {/dede:arclist} </dl>
That's it , many people will not use the default template of DEDECMS, so the latest tag I call here is different from yours. If your homepage uses the default template, you only need to add the following code:
<span>[field:pubdate function="MyDate('m-d',@me)"/]</span>
Replace it with the following code:
<span>[field:pubdate runphp='yes'] $a="<font color='#ff0000'>"; $d="<font color='#858585'>"; $b="</font>"; $c=strftime("%m-%d","@me"); $ntime = time(); $oneday = 3600 * 24; if(($ntime - @me)<$oneday) @me = $a.$c.$b; else @me = $d.$c.$b; [/field:pubdate] </span>
That’s it!
The above is the detailed content of How to make the title of Dreamweaver's latest post appear red within 24 hours. For more information, please follow other related articles on the PHP Chinese website!