黄景龙 發表於 2023-10-1 00:00:00

DEDE热门tag,DEDE首页digg,DEDE随机热门关键字调用方法

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <strong>DIGG</strong></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        orderby=digg 就是按照DIGG的次数来排序的</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        {dede:arclist row=5 titlelen=24 orderby=digg}<br>
        &lt;br/&gt;<br>
        {/dede:arclist}</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        具体详细代码如下</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        &lt;div class="dignews margintop"&gt;<br>
        &lt;div class="digtitle"&gt;&lt;span&gt;&lt;/span&gt;<br>
        &lt;ul id="digtitle"&gt;<br>
        &lt;li&gt;&lt;a href="###"&gt;热门&lt;/a&gt; &lt;/li&gt;<br>
        &lt;li&gt;&lt;a href="###"&gt;推荐&lt;/a&gt; &lt;/li&gt;<br>
        &lt;li&gt;&lt;a href="###"&gt;关注&lt;/a&gt; &lt;/li&gt;<br>
        &lt;/ul&gt;<br>
        &lt;/div&gt;<br>
        &lt;dl id="diglist"&gt;&lt;dt&gt;正在载入,请稍后... &lt;!--DIG菜单:热门--&gt;&lt;/dt&gt;&lt;dd&gt;&lt;!--DIG循环体开始--&gt;{dede:arclist row=5 titlelen=24 orderby=digg} <br>
        &lt;div class="digbox" id="digboxa"&gt;<br>
        &lt;div class="diglink" id="digg"&gt;&lt;span&gt;&lt;/span&gt; &lt;a class="digvisited" href="javascript:Digg('digg',);"&gt;&lt;!--顶一下--&gt;&lt;/a&gt;&lt;/div&gt;<br>
        &lt;div class="title"&gt;&lt;span&gt;&lt;/span&gt; &lt;/div&gt;<br>
        &lt;div class="preview"&gt;... &lt;/div&gt;<br>
        &lt;/div&gt;<br>
        {/dede:arclist} &lt;!--DIG循环体结束--&gt;&lt;!--DIG菜单:推荐--&gt;&lt;/dd&gt;&lt;dd&gt;&lt;!--DIG循环体开始--&gt;{dede:arclist row=5 titlelen=24 orderby=digg att=5} <br>
        &lt;div class="digbox" id="digboxb"&gt;  <br>
        &lt;div class="diglink" id="digg"&gt;&lt;span&gt;&lt;/span&gt; &lt;a class="digvisited" href="javascript:Digg('digg',);"&gt;&lt;!--顶一下--&gt;&lt;/a&gt;&lt;/div&gt;<br>
        &lt;div class="title"&gt;&lt;span&gt;&lt;/span&gt; &lt;/div&gt;<br>
        &lt;div class="preview"&gt;... &lt;/div&gt;<br>
        &lt;/div&gt;<br>
        {/dede:arclist} &lt;!--DIG循环体结束--&gt;&lt;!--DIG菜单:关注--&gt;&lt;/dd&gt;&lt;dd&gt;&lt;!--DIG循环体开始--&gt;{dede:arclist row=5 titlelen=24 orderby=click}</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        &lt;div class="digbox" id="digboxc"&gt;<br>
        &lt;div class="diglink" id="digg"&gt;&lt;span&gt;&lt;/span&gt; &lt;a class="digvisited" href="javascript:Digg('digg',);"&gt;&lt;!--顶一下--&gt;&lt;/a&gt;&lt;/div&gt;<br>
        &lt;div class="title"&gt;&lt;span&gt;&lt;/span&gt; &lt;/div&gt;<br>
        &lt;div class="preview"&gt;... &lt;/div&gt;<br>
        &lt;/div&gt;<br>
        {/dede:arclist} &lt;!--DIG循环体结束--&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;<br>
        &lt;/div&gt;  <br>
        &lt;!--左侧栏结束--&gt;&lt;!--中栏--&gt;</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        DEDE5的DIGG功能,顶完可以看到“顶”的数量是加了1,但是如果刷新页面,你会发现“顶”的数量有复原了。<br>
        这是因为文章被顶数,已经被生成了静态HTML固定下来显示了,除非直到下一次后台更新此文章</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        那么我做了以下修改,就是当当前文章被顶的时候,同时更新一次该文章,让它的静态HTML里的“顶”数是最新的真实数字。 </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        修改方法很简单,如下:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        打开DEDE根目录下的digg.php 文件,在26行插入以下三行代码即可<br>
        include_once(dirname(__FILE__)."/include/inc_archives_view.php");<br>
        $arc = new Archives($aid);<br>
        $reurl = $arc-&gt;MakeHtml();</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br><strong>首页实现顶一下自动刷新一下方法: </strong></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        打开diggindex.php 文件。。<br>
        找到<br>
        header("Expires:0");<br>
        header("Content-Type: text/html; charset=gb2312");</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        在下面加入<br>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        <p>
                代码如下:</p>
</div>
<div class="msgborder" id="phpcode2" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        if($action == indexdigg ){<br>
        echo '&lt;span&gt;'.$row['digg'].'&lt;/span&gt;';<br>
        echo "&lt;a class=\"digvisited\" href=\"javascript:Digg(\"digg\",".$aid.");\"&gt;&lt;/a&gt;";<br>
        exit();<br>
        } </div>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>首页模板加入</span></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        <p>
                代码如下:</p>
</div>
<div class="msgborder" id="phpcode3" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        &lt;!-- Digg 参数 --&gt;<br>
        <br>
         </div>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>实例:</span></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        &lt;div class="right"&gt;&lt;!-- Digg 参数 --&gt;<br>
        <br>
        <br>
        &lt;div class="digtitle"&gt;DIGG排行&lt;/div&gt;<br>
        &lt;div class="diglist"&gt;<br>
        {dede:arclist row=9 titlelen=24 infolen='29' orderby=digg}<br>
        &lt;dd&gt;<br>
        &lt;div class="diglink" id="digg"&gt;&lt;span&gt;&lt;/span&gt; &lt;a class="digvisited" href="javascript:Digg('digg',);"&gt;&lt;!--顶一下--&gt;&lt;/a&gt;&lt;/div&gt; <br>
        &lt;h3&gt;&lt;/h3&gt; <br>
        ...<br>
        &lt;/dd&gt;<br>
        {/dede:arclist}<br>
        &lt;/div&gt;<br>
        &lt;/div&gt;</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        模板代码:<br>
        {dede:tag row='10' sort='month' } &lt;a class="tag" href=""&gt; &lt;/a&gt;{/dede:tag} </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        CSS代码:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        .tag1 { color:#339900;font-weight:bold;}<br>
        .tag2 { color:#e65730;}<br>
        .tag3 { color:#00b9da;}<br>
        .tag4 { color:#FE3981;font-weight:bold;font-size:14px;}</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        更换标签方式: <br>
        默认调用的是当月热门标签,如果换想其他的可以: <br>
        最新标签 {dede:tag row='30' sort='new'}&lt;a href=""&gt;()&lt;/a&gt; {/dede:tag}<br>
        当月热门标签 {dede:tag row='30' sort='month'}&lt;a href=""&gt;()&lt;/a&gt; {/dede:tag}<br>
        随机标签 {dede:tag row='60' sort='rand'}&lt;a href=""&gt;()&lt;/a&gt; {/dede:tag}</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        网页部分的代码如下:<br>
        &lt;div&gt;<br>
        &lt;h2&gt;&lt;span&gt;热门标签 &lt;img alt="" src=http://qlzhan.com/a/DEDEcms/20091005/"images_ex/image_v1/ico_arrow_black.gif" /&gt;&lt;/span&gt;&lt;/h2&gt;<br>
        &lt;ul&gt;{dede:loop table='dede_search_keywords' sort='keyword' row='40' if=''}<br>
        &lt;li&gt;&lt;a class="tag" href="plus/search.php?keyword="&gt;&lt;/a&gt; {/dede:loop} &lt;/li&gt;<br>
        &lt;/ul&gt;<br>
        &lt;/div&gt;<br>
        <br>
        &lt;div&gt;&lt;/div&gt;<br>
        CSS部分的代码如下:<br>
        .tag1 { color:#339900;font-weight:bold;}<br>
        .tag2 { color:#e65730;}<br>
        .tag3 { color:#00b9da;}<br>
        .tag4 { color:#FE3981;font-weight:bold;font-size:14px;} <br>
        使用说明: ◆此彩色关键字代码中有4种颜色的变化,如果想增加更多颜色变化, 只需要修改var num=4;和css部分增加.tag 例如:var num=5; css里增加.tag5{ color:#00b9da;} ,当然,自己也可以修改相应css,改变字体的颜色,大小,字体...等等,自由发挥吧!</p>
頁: [1]
查看完整版本: DEDE热门tag,DEDE首页digg,DEDE随机热门关键字调用方法