[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

藏色散人
藏色散人Original
2020-01-03 09:26:512552browse

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=&#39;60&#39; noflag=&#39;h&#39; row=&#39;13&#39;} 
<dd><ul> 
<li><span>[field:pubdate function="MyDate(&#39;m-d&#39;,@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=&#39;60&#39; noflag=&#39;h&#39; row=&#39;13&#39;} 
<dd><ul> 
<li><span>[field:pubdate runphp=&#39;yes&#39;]  
$a="<font color=&#39;#ff0000&#39;>";  
$d="<font color=&#39;#858585&#39;>";  
$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(&#39;m-d&#39;,@me)"/]</span>

Replace it with the following code:

<span>[field:pubdate runphp=&#39;yes&#39;]  
$a="<font color=&#39;#ff0000&#39;>";  
$d="<font color=&#39;#858585&#39;>";  
$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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn