Dedecms (Dream) to add to the column icon full Raiders __dedecms

Source: Internet
Author: User

Because of the special needs of this site for a certain column of this station to add an icon, but because Dedecms column is not like phpcms can add icons to the column. So I found a lot of information on the Internet, but not very full. By reference to these materials finally realized the function of the column add icon. And also made the default icon settings for the column. The following specific methods are shared as follows:
First, in the background column add and modify the page to add Column icon a column
The effect chart is as follows:



How to operate:
1. The dede\templets\catalog_add.htm or the meeting editor opens the directory under
2, add JS in the code is:
The first one, find the following code: <title> column Management </title> <link href= "css/base.css" rel= "stylesheet" type= "Text/css" > This Code The copy code is followed by adding <script language= ' javascript ' src= ' js/main.js ' ></script> copy code, find this code <tr> &LT;TD class = ' bline ' height= ' style= ' padding-left:10px; ><font color= ' red ' > column name:</font></td> <td class= ' bline ' ><input name= ' typename "type=" Text "id=" TypeName "size=" class= "iptxt"/></td> </tr> Copy code added under it <tr> <td class= ' bline ' Heig ht= "style=" padding-left:10px; > column icon:</td> <td class= ' bline ' ><input name= "icon" type= "text" id= "icon" size= "/> <input name = "Sel1" type= button "id=" Sel1 "value=" select "onclick=" Selectimage (' Form1.icon ', ' small ') "/></td> </tr> Copy Code 3, a trick or a meeting editor open dede\templets\catalog_edit.htm under directory
4, modify content and methods with the same as the 2nd step.

#p # subtitle #e#

Add icon fields to the column list (arctype) in the database (typeimg or icon)
Effect chart

The specific actions are as follows:
1, in the datasheet below the Add field click to execute

2, add the field parameters as shown in the following figure





#p # subtitle #e#
Third, modify the column to add and modify the submission code
1, open the directory under the Dede\ catalog_add.php file add the following code $icon = Trim ($_post[' icon '); The copy code $queryTemplate = "INSERT into ' dede_arctype ' (Reid,topid,sortrank,typename,typedir,isdefault,defaultname, Issend,channeltype, Tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description, Keywords,seotitle,moresite,siteurl,sitepath,ishidden, ' Cross ', ' crossid ', ' typeimg ', ' content ', ' smalltypes ') VALUES (' ~reid~ ', ' ~topid~ ', ' ~rank~ ', ' ~typename~ ', ' ~typedir~ ', ' $isdefault ', ' $defaultname ', ' $issend ', ' $channeltype ', ' $ Tempindex ', ' $templist ', ' $temparticle ', ' Default ', ' $namerule ', ' $namerule 2 ', ' 0 ', ' 0 ', ', ', ', ' ~typename~ ', ' 0 ', ', ', ', ', ' ' 0 ', ' 0 ', ' 0 ', ', ' '; Change into
$queryTemplate = "INSERT into ' dede_arctype ' (Reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend, Channeltype, Tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords, Seotitle,moresite,siteurl,sitepath,ishidden, ' Cross ', ' crossid ', ' typeimg ', ' content ', ' smalltypes ') VALUES (' ~reid~ ' , ' ~topid~ ', ' ~rank~ ', ' ~typename~ ', ' ~typedir~ ', ' $isdefault ', ' $defaultname ', ' $issend ', ' $channeltype ', ' $tempindex ' , ' $templist ', ' $temparticle ', ' Default ', ' $namerule ', ' $namerule 2 ', ' 0 ', ' 0 ', ', ', ', ' ~typename~ ', ' 0 ', ', ', ', ' 0 ', ' 0 ', ' 0 ', ' $icon ', ', ', ') '; Copy code $in _query = "INSERT into ' dede_arctype ' (Reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend, Channeltype, Tempindex,templist,temparticle,modname,namerule,namerule2, Ispart,corank,description,keywords, Seotitle,moresite,siteurl,sitepath,ishidden, ' Cross ', ' crossid ', ' typeimg ', ' content ', ' smalltypes ') VALUES (' $reid ', ' $topid ', ' $sortrank ', ' $typename ', ' $typedir ', ' $isdefault ', ' $defaultname ', ' $issend ', ' $channeltype ',' $tempindex ', ' $templist ', ' $temparticle ', ' Default ', ' $namerule ', ' $namerule 2 ', ' $ispart ', ' $corank ', ' $description ', ' $keywords ', ' $seotitle ', ' $moresite ', ' $siteurl ', ' $sitepath ', ' $ishidden ', ' $cross ', ' $crossid ', ' $content ', ' $ Smalltypes ') "; Modified into

$in _query = "INSERT into ' dede_arctype ' (Reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend, Channeltype, Tempindex,templist,temparticle,modname,namerule,namerule2, Ispart,corank,description,keywords, Seotitle,moresite,siteurl,sitepath,ishidden, ' Cross ', ' crossid ', ' typeimg ', ' content ', ' smalltypes ') VALUES (' $reid ', ' $topid ', ' $sortrank ', ' $typename ', ' $typedir ', ' $isdefault ', ' $defaultname ', ' $issend ', ' $channeltype ', ' $tempindex ', ' $templist ', ' $temparticle ', ' Default ', ' $namerule ', ' $namerule 2 ', ' $ispart ', ' $corank ', ' $description ', ' $keywords ', ' $seotitle ', ' $moresite ', ' $siteurl ', ' $sitepath ', ' $ishidden ', ' $cross ', ' $crossid ', ' $icon ', ' $content ', ' $smalltypes ' )"; Copy code 2, open Directory dede\ catalog_edit.php file add the following code
Code at the beginning add: $icon = Trim ($_post[' icon ']); Copy the code in ' content ' = ' $content ', and add ' typeimg ' = ' $icon ' later,

#p # subtitle #e#
Iv. Modify the column call label (CHANNL)
1, open the directory under the include\taglib\channel.lib.php file, this file is the CHANNL label file. Find values for all $sql parameters such as: $sql = "Select Id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl, Sitepath,description from ' Dede_arctype ' where reid= ' $reid ' and ishidden<>1 ORDER by Sortrank ASC limit 0, $row "; The copy code adds the Typeimg field to the field value you are searching for. Added is: $sql = "Select Id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath, Description,typeimg from ' Dede_arctype ' where reid= ' $reid ' and ishidden<>1 ORDER by Sortrank ASC limit 0, $row "; Copy code 2, and when the call is displayed, check to see if there are any column icons that have not been set to the default column icon. Found in my file: if ($row = $dsql->getarray ()) Copy code to add a judgment statement after it: if ($row [' typeimg ']== ') {$row [' typeimg ']= $GLOBALS] [' Cfg_ Cmspath ']. ' /images/defaultbookimg.gif '; Copy the code so that if you do not set the target accountability icon, the system is automatically set to the Defaultbookimg.gif picture as the column icon.
The same method can also be used to modify the fields in the tag file of other calling columns. Here is more not to say, if a netizen still don't understand please reply or contact me. To explain the problem and make changes.
V. Invoke the modified label and test
In the column call

{dede:channel type= ' top ' row= ' currentstyle= "<li class= ' hover ' ><a href= ' ~typelink~ ' ~rel~><span >~typename~</span></a></li> "} <li><a href= ' [field:typeurl/] ' [field:rel/]>< span>[field:typename/]</span></a></li> {/dede:channel}


You can use [field:typeimg] to invoke the column icon.

Well, here we are in the dream to add an icon to the column of the way to explain the end, I hope that the network in useful. If there is a time when the place is not very understand or do not understand please contact me. Contact: Learning Home (http://www.xxzj51.com) Sorry, because the original code copied to the show here is not very good. Everyone can go and see forgiveness. Thank you for your support. This article address: http://www.xxzj51.com/a/CMSjiaocheng/DedeCmsjiaocheng/shiyongjiao/2012/1009/189_4.html

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.