Weaving Dream CMS Home Add Digg top-up modification method

Source: Internet
Author: User

Now pull out the top of the article content page, share a friend you need to refer to the use of
(Special note: Red is the place to modify)
The first step:
The top-stepping JS and Ajax extracted, placed in the desired use of the page (such as: Home)
The following is the content page at the top of the JS, extracted to make a slight change, and finally the following:

<script language= "javascript" type= "Text/javascript" src= "{dede:global.cfg_cmsurl/}/include/dedeajax2.js" > </script><script language= "JavaScript" ><!--function Postdigg (ftype,aid,tomode) {var taget_obj = document.getElementById (' Newdigg ' + ' _ ' +aid); var Saveid = GetCookie (' Diggid ' +aid); if (Saveid! = null) {var saveids = Saveid.split (', '); var Hasid = False;saveid = "; j = 1;for (i=saveids.length-1;i>=0;i--) {if (Saveids==aid && Hasid) Continue;else {if (saveids==aid &&!hasid) Hasid = True;saveid + = (saveid== '? Saveids: ', ' +saveids '); j++;i F (j==20 && Hasid) break;if (j==19 &&!hasid) break;}} /* Comment out the following two lines, you can keep the top, easy to test, to limit the top, the comment "//" removed can be *///if (HASID) {alert ("You have already topped the post, please do not repeat the top!") "); Return }//else Saveid + = ', ' +aid; Setcookie (' Diggid ' +aid,saveid,1);} Else{setcookie (' Diggid ' +aid,aid,1);} Myajax = new Dedeajax (Taget_obj,false,false, ', ', '); var url = "{dede:global.cfg_phpurl/}/digg_ajax.php?action=" + Ftype+ "&id=" +aid+ "&tomode=" +tomode;myajax. SendGet2(URL);} function Getdigg (aid,tomode) {var taget_obj = document.getElementById (' Newdigg ' + ' _ ' +aid); myajax = new Dedeajax (taget_ Obj,false,false, ', ', '); Myajax. SendGet2 ("{dede:global.cfg_phpurl/}/digg_ajax.php?id=" +aid+ "&tomode=" +tomode);D edexhttp = null;} --></script>


Second Step, modify/plus/digg_ajax.php This file
in the last
}
Ajaxhead ();
Echo $digg;
exit ();

if ($_get[' tomode ']== ' xlist ') {
$digg = ";
$digg = ' <div id= ' newdigg_ '. $id. ' "
<em>[. $row [' Goodpost ']. </em>
<b onclick= "Postdigg (\ ' good\ ', '. $id. ', ' xlist\ ')" > Top </b>
<span> ". $row [' Goodper ']. ' %</span>
</div> ";


How to use:
Add the following code to the title or record that you want to add to the top:

<div class= "XLISTDD" id= "Newdigg_[field:id/]" ><em>[field:goodpost/]</em><b onclick= "PostDigg (' good ', [field:id/], ' xlist ') "> Top </b><span>[field:goodper/]%</span></div><script language= "JavaScript" type= "Text/javascript" >getdigg ([Field:id/], ' xlist ');</script>


********************************************************************************************
Instance:
This is the CSS style for testing This example, you can write your own style as needed ************************************

<style>.xtesttop {clear:both;}. Xtesttop H2 {font-size:30px;line-height:35px;height:35px;font-family: Microsoft Jacob Black; float:left;}. XLISTDD * {text-align:center;}. XLISTDD {background:url ();/** background **/width:50px;/** "top" div width **/height:50px;/** "top" div height **/padding:3px;/** inner margin **/bor Der:solid 1px #ddd;/** border **/float:left;}. XLISTDD the style of the EM {/** "top" number **/font-size:20px;color:red;font-style:normal;display:block;}. XLISTDD B {/** "top" mouse style here is hand **/cursor:hand;font-weight:normal;/** remove bold **/}.XLISTDD span {display:block;/** If you do not want to show this percentage , change the Display:block to Display:none can be **/font-family:arial;font-size:10px;} </style>



This is the CSS style for testing This example, you can write your own style as needed ************************************{dede

: Arclist flag= ' h ' titlelen = row= ' 3 ' infolen= ' '}<div style = ' clear:both; ' ><div class= "XLISTDD" id= "Newdigg_[field:id/]" ><em>[field:goodpost/]</em><b onclick= " Postdigg (' good ', [field:id/], ' xlist ') "> Top </b><span>[field:goodper/]%</span></div> <script language= "javascript" type= "Text/javascript" >getdigg ([Field:id/], ' xlist ');</script> 

(Turn) Weaving dream CMS Home Add Digg top-up modification method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.