How to call DEDE popular keywords?
Popular tags in DEDE, DEDE homepage digg, DEDE random popular keyword calling methods, friends in need can refer to the following
Recommended learning: 梦Weavercms
DIGG
orderby=digg is sorted according to the number of DIGG
{dede:arclist row=5 titlelen=24 orderby=digg} [field:textlink/] [field:digg/]<br/> {/dede:arclist}
The specific detailed code is as follows
<div class="dignews margintop"> <div class="digtitle"><span></span> <ul id="digtitle"> <li><a href="###">热门</a> </li> <li><a href="###">推荐</a> </li> <li><a href="###">关注</a> </li> </ul> </div> <dl id="diglist"><dt>正在载入,请稍后... <!--DIG菜单:热门--></dt><dd><!--DIG循环体开始-->{dede:arclist row=5 titlelen=24 orderby=digg} <div class="digbox" id="digboxa"> <div class="diglink" id="digg[field:id/]"><span>[field:digg/]</span> <a class="digvisited" href="javascript:Digg('digg',[field:id/]);"><!--顶一下--></a></div> <div class="title">[field:textlink/]<span>[field:pubdate function=strftime('%m-%d',@me)/]</span> </div> <div class="preview">[field:info/]... </div> </div> {/dede:arclist} <!--DIG循环体结束--><!--DIG菜单:推荐--></dd><dd><!--DIG循环体开始-->{dede:arclist row=5 titlelen=24 orderby=digg att=5} <div class="digbox" id="digboxb"> <div class="diglink" id="digg[field:id/]"><span>[field:digg/]</span> <a class="digvisited" href="javascript:Digg('digg',[field:id/]);"><!--顶一下--></a></div> <div class="title">[field:textlink/]<span>[field:pubdate function=strftime('%m-%d',@me)/]</span> </div> <div class="preview">[field:info/]... </div> </div> {/dede:arclist} <!--DIG循环体结束--><!--DIG菜单:关注--></dd><dd><!--DIG循环体开始-->{dede:arclist row=5 titlelen=24 orderby=click} <div class="digbox" id="digboxc"> <div class="diglink" id="digg[field:id/]"><span>[field:digg/]</span> <a class="digvisited" href="javascript:Digg('digg',[field:id/]);"><!--顶一下--></a></div> <div class="title">[field:textlink/]<span>[field:pubdate function=strftime('%m-%d',@me)/]</span> </div> <div class="preview">[field:info/]... </div> </div> {/dede:arclist} <!--DIG循环体结束--></dd></dl></div> </div> <!--左侧栏结束--><script language="javascript" type="text/javascript"> <!-- //DIGG资讯无刷新切换 pigzmo("digtitle","diglist",3,3000); --> </script><!--中栏-->
DEDE5 With the DIGG function, you can see that the number of "likes" has been increased by 1 after you like it, but if you refresh the page, you will find that the number of "likes" has been restored.
This is because the article has been liked and static HTML has been generated and fixed for display, unless the article is updated in the background next time.
Then I made the following modifications, that is, when the current article When it is liked, the article is updated at the same time so that the number of "likes" in its static HTML is the latest real number.
The modification method is very simple, as follows:
Open the digg.php file in the root directory of DEDE and insert the following three lines of code in line 26
include_once(dirname(__FILE__)."/include/inc_archives_view.php"); $arc = new Archives($aid); $reurl = $arc->MakeHtml();
The home page can be topped How to automatically refresh at once:
Open the diggindex.php file. .
Find
header("Expires:0"); header("Content-Type: text/html; charset=gb2312");
Add
below and the code is as follows:
if($action == indexdigg ){ echo '<span>'.$row['digg'].'</span>'; echo "<a class=\"digvisited\" href=\"javascript:Digg(\"digg\",".$aid.");\"></a>"; exit(); }
Home page template add
The code is as follows:
<!-- Digg 参数 --> <script language="javascript" src="{dede:global name='cfg_cmspath'/}/include/dedeajax2.js"></script> <script language="javascript"> function Digg(divId,aid){ var taget_obj = document.getElementById(divId+''+aid); var myajax = new DedeAjax(taget_obj,false,false,"","",""); myajax.SendGet2("/diggindex.php?action=indexdigg&aid="+aid); DedeXHTTP = null; } </script>
Example:
<div class="right"><!-- Digg 参数 --> <script language="javascript" src="{dede:global name='cfg_cmspath'/}/include/dedeajax2.js"></script> <script language="javascript"> function Digg(divId,aid){ var taget_obj = document.getElementById(divId+''+aid); var myajax = new DedeAjax(taget_obj,false,false,"","",""); myajax.SendGet2("/diggindex.php?action=indexdigg&aid="+aid); DedeXHTTP = null; } </script> <div class="digtitle">DIGG排行</div> <div class="diglist"> {dede:arclist row=9 titlelen=24 infolen='29' orderby=digg} <dd> <div class="diglink" id="digg[field:id/]"><span>[field:digg/]</span> <a class="digvisited" href="javascript:Digg('digg',[field:id/]);"><!--顶一下--></a></div> <h3>[field:textlink/]</h3> [field:info/]... </dd> {/dede:arclist} </div> </div>
Template code:
{dede:tag row='10' sort='month' } <a class="tag" href="[field:link/]">[field:tagname/] </a>{/dede:tag} <script language="javascript"> <!-- var tag_a=document.getElementsByTagName("a"); for( i in tag_a){ var offset=6; var num=4; if(tag_a[i].className=="tag"){ var rnd=Math.ceil((num+offset)*Math.random()); if(rnd>offset){ tag_a[i].className="tag"+(rnd-offset); } } } //--> </script>
CSS code:
.tag1 { color:#339900;font-weight:bold;} .tag2 { color:#e65730;} .tag3 { color:#00b9da;} .tag4 { color:#FE3981;font-weight:bold;font-size:14px;}
How to change tags:
The popular tags of the month are called by default. If You can think of something else:
Latest tag{dede:tag row='30' sort='new'}[field:highlight/] ([field:result/]) {/dede:tag}
Popular tags of the month{dede:tag row='30' sort='month'}[field:tagname/]([field:result/]) {/dede:tag}
Random tag{dede:tag row='60' sort='rand'}[field:highlight/]([field:result/]) {/dede:tag}
The code of the web page part is as follows:
<div> <h2><span>热门标签 <img alt="" src=http://qlzhan.com/a/DEDEcms/20091005/"images_ex/image_v1/ico_arrow_black.gif" /></span></h2> <ul>{dede:loop table='dede_search_keywords' sort='keyword' row='40' if=''} <li><a class="tag" href="plus/search.php?keyword=[field:keyword/]">[field:keyword/]</a> {/dede:loop} </li> </ul> </div> <script language="javascript"> <!-- var tag_a=document.getElementsByTagName("a"); for( i in tag_a){ var offset=6; var num=4; if(tag_a[i].className=="tag"){ var rnd=Math.ceil((num+offset)*Math.random()); if(rnd>offset){ tag_a[i].className="tag"+(rnd-offset); } } } //--> </script> <div></div>
The code of the CSS part is as follows:
.tag1 { color:#339900;font-weight:bold;} .tag2 { color:#e65730;} .tag3 { color:#00b9da;} .tag4 { color:#FE3981;font-weight:bold;font-size:14px;}
Instructions for use: ◆There are 4 color changes in this color keyword code, if you want to add more To change the color, you only need to modify var num=4; and add .tag to the css part. For example: var num=5; add .tag5{ color:#00b9da;} to the css. Of course, you can also modify the corresponding css to change the font color. , size, font...etc., feel free to play with it!
The above is the detailed content of How to call DEDE popular keywords. For more information, please follow other related articles on the PHP Chinese website!