DeDeCms column to increase thumbnails

Note: dedecms version of this tutorial is: version V5.7SP2 utf-8.


First, add a picture field typeimg to dede_arctype column data types table

Through the system - SQL command line tool, enter the code below performs
alter table `dede_arctype` add` typeimg` varchar (200) NOT NULL default '';
mean typeimg adding a field in a database table dede_arctype, the name can be customized typeimg name.

Second, modify the file:  

       Dede / catalog_add.php
  Dede / catalog_edit.php
  Dede / templets / catalog_add.htm
  Dede / templets / catalog_edit.htm
PS: Dede as the default folder background


$ typeimg ', save! 2) Modify dede / catalog_edit.php document found typename = '$ typename' in line 41, a new row in its lower side




















= typeimg '$ typeimg',

. 3) Modify dede / templets / catalog_add.htm template file
first in the <head> tag species adding <script language = 'javascript' src = "js / main.js"> </ script>
and then casually to find a location, I was in the name of the column below to add
find this line of code:
          <TR>
            <td class = 'BLine' height = "26" style = "padding-left: 10px;"> <font Color = 'Red' > column name: </ font> </ TD>
            <TD class = 'BLine'> <INPUT name = "typename" type = "text" ID = "typename" size = "30" class = "iptxt" /> < / TD>
          </ TR>
          
         add the following code at its lower
<TR>
            
            <TD class = 'BLine' height = "26 is" style = "padding-left: 10px;">栏目缩略图:</td>
            <td class='bline'>
                <input name="typeimg" type="text" style="width:300px" id="typeimg" class="alltxt" value="" />
            <input type = "button" name = "set9" value = " Browse ..." class = "coolbg np" style = "width: 60px" onClick = "SelectImage ( 'form1.typeimg', '');" / >
                </ TD>
                       
          </ TR>
save.

4) modify dede / templets / catalog_edit.htm template file
first in the <head> tag species adding <script language = 'javascript' src = "js / main.js"> </ script>
and then find the position of the column name,
<TR > 
            <TD class = 'BLine' height = "26 is" style = "padding-left: 10px;"> <font Color = 'Red'> column name: </ font> </ TD>
            <TD class = 'BLine' > <input name = "typename" type = "text" id = "typename" size = "30"




            <td class='bline' >
                <input name="typeimg" type="text" style="width:300px" id="typeimg" class="alltxt" value="<?php echo $myrow['typeimg']?>" />
<input type="button" name="set9" value="浏览... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.typeimg','');" />
                 </td>
          </tr>
保存即可。


Third, how to call thumbnails

Under normal circumstances we call the column when there are 2 ways {dede: chanel} and {dede: type}, so we need to modify the following two files
  the include / taglib / channel.lib.php
  the include / taglib / type.lib.php
1) modify include / taglib / channel.lib.php
78 - between the line 94, to find the following code
    IF (type == $ 'Top')
    {
        $ SQL = "the SELECT ID, typename, typedir, IsDefault, ispart, defaultName , namerule2, moresite, siteurl, sitepath
          the From __ arctype` `# @ = 0 And the WHERE Reid isHidden <> Order by sortrank ASC limit. 1 0, $ Line";
    }
    the else IF (type == $ 'Son')
    {
        IF ($ == 0 the typeid) return '';
        $ SQL = "the SELECT ID, typename, typedir, IsDefault, ispart, defaultName, namerule2, moresite, siteurl, sitepath
          From `#@__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
            FROM `#@__arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
    }
在每个typename的后边添加typeimg,一共三处,修改后的代码为
    if($type=='top')
    {
        $sql = "SELECT id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
          From `#@__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,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
          From `#@__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,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
            FROM `#@__arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
    }
保存文件。
调用时可通过{dede:call tag chanel}
      {dede: channel type = 'top
 <Li> <a href='[field:typelink/]'> <IMG the src = "[Field: typeimg /]" /> </a> </ Li>
{/ Dede: Channel}
    
    2) modify include / taglib /type.lib.php
    found $ row = $ dsql- at 42 row> GetOne ( "SELECT id, typename ,
    add typeimg its back, it only modified as follows:
    $ row = $ dsql-> GetOne (" the SELECT ID , typename, typeimg,
    . save the file
    
    method is called by the page may be any template {dede: type} way call, as follows:
    {Dede: the typeid type = '. 5'}
<a href="[field:typelink /]"> <IMG the src = "[Field: typeimg /]" /> </a>
{/ Dede: type}
    
    . 3) is called the current page thumbnail of the column sections may be used directly <img src = "{dede: field.typeimg /} "/> call.

Guess you like

Origin www.cnblogs.com/zsdblog/p/12397899.html