Dedecms Background Add the implementation code of the column picture

Source: Internet
Author: User
This article mainly introduces the DEDECMS backstage add column picture implementation code related data, very good, with reference value, need friends can refer to the next

Dedecms template Download Address: www.php.cn/xiazai/code/dedecms

The foreground calls the column needs to display the icon, organizes:

First step: "System->sql Command Tool", insert SQL statement

The code is as follows:

ALTER TABLE Dede_arctype add imgtype varchar (100)

The second step: go to the Background Management file directory (the default is: Dede directory), find "catelog_add.php" under the 228 lines, replace the following default (added "Typeimg" in the SQL statement)

The code is as follows:

$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 ',    ' content ', ' smalltypes ', ' typeimg ')    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 ', ' $typeimg ');

Step three: Find the 36 line under "catelog_edit.php" Replace the default (add "Typeimg" in the SQL statement)

The code is as follows:

    $upquery = "UPDATE ' dede_arctype ' SET     issend= ' $issend ',     sortrank= ' $sortrank ',     typename= ' $typename ',     typedir= ' $typedir ',     isdefault= ' $isdefault ',     defaultname= ' $defaultname ',     issend= ' $issend ',     ishidden= ' $ishidden ',     channeltype= ' $channeltype ',     tempindex= ' $tempindex ',     templist= ' $ Templist ',     temparticle= ' $temparticle ',     namerule= ' $namerule ',     namerule2= ' $namerule 2 ',     Ispart= ' $ispart ',     corank= ' $corank ',     description= ' $description ',     keywords= ' $keywords ',     Seotitle= ' $seotitle ',     moresite= ' $moresite ',     ' cross ' = ' $cross ',     ' content ' = ' $content ',     ' Crossid ' = ' $crossid ',     ' typeimg ' = ' $typeimg ',     ' smalltypes ' = ' $smalltypes '     $uptopsql    WHERE id= ' $ Id ' ";

Fourth step: Go to the "catalog_add.htm and catalog_edit.htm" file under the Background Management file directory (default: Dede directory)/templets/, then add the following code:

The code is as follows:

<script language= ' javascript ' src= ' js/main.js ' ></script>

and add the following code where you want to place it:

The code is as follows:

<tr> <td colspan= "2" > <table width= "100%" border= "0" cellspacing= "0" cell padding= "0" style= "MARGIN-BOTTOM:3PX;" > <tbody> <tr> <td wid                                    Th= "class=" Bline "height=" >&nbsp;imgmm:</td> <td class= "Bline" >                                     <input type= "text" name= "typeimg" id= "imgmm" style= "width:300px" class= "text"/> <input name= "IMGMM_BT" type= "button" class= "Inputbut" value= "Browse ..." onclick= "selecti                        Mage (' form1.imgmm ', ' big ') '/> </td> </tr> </tbody> </table> <input type= "hidden" name= "Dede_add Onfields "value=" imgmm,img "/> </td> </tr>

Fifth step: Call the column Pass channel label call, so to change, go to the/include/taglib/channel.lib.php file, find 78 lines, replace the following code with the default (Add typeimg field query)

The code is as follows:

if ($type = = ' top ')    {        $sql = "Select Id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite, Siteurl,sitepath,typeimg from          ' Dede_arctype ' WHERE reid=0 and ishidden<>1 ORDER by Sortrank ASC limit 0, $line " ;    }    else if ($type = = ' son ')    {        if ($typeid ==0) return ';        $sql = "Select Id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,content, Typeimg from          ' dede_arctype ' WHERE reid= ' $typeid ' and ishidden<>1 ORDER by Sortrank ASC limit 0, $line ";    }    else if ($type = = ' self ')    {        if ($reid ==0) return ';        $sql = "Select Id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg            From ' Dede_arctype ' WHERE reid= ' $reid ' and ishidden<>1 ORDER by Sortrank ASC limit 0, $line ";    }

The last step: Call the

The code is as follows:

 {dede:channel type= ' self ' typeid= ' row= ' 8 ' currentstyle= ' <li><a href= ' ~typelink~ ' class= ' thisclass ' >~typename~</a> </li> '} <li><a href= ' [field:typelink/] ' >[field:typename/]</a> </li> {/dede:channel} 

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.