This article mainly introduces the weaving dream dedecms in the implementation of Chinese and English navigation function method Step, this article gives detailed operation steps and related implementation code, the need for friends can refer to the following
Today in the group to see a friend need to implement the Chinese and English column name function (such as), below we will look at the powerful weaving dream cms how to achieve it!
Dedecms template Download Address: www.php.cn/xiazai/code/dedecms
First add a field to the Dede_arctype table in the database, the previous table prefix is the name of your site, and it is not necessarily dede_
After the addition of the effect, such as the specific way to add again is not detailed. Where Typenameng is my added field, the name is a bit long, of course, you can also change your own happy name, this does not hurt.
and find the catalog_edit.htm in the Dede\templets directory.
Found it
The code is as follows:
<tr> <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= "value=" <?php echo $myrow [' TypeName ']?> ' class= ' iptxt '/></td> </tr>
Add the following
The code is as follows:
<tr> <td class= ' bline ' height= "style=" padding-left:10px; > English name:</td> <td class= ' bline ' > <input name= "Typenameng" type= "text" id= "Typenameng" Size= "value=" <?php echo $myrow [' Typenameng ']?> ' class= ' iptxt '/></td></tr>
Finally, we're opening the dede\catalog_edit.php.
Found it
The code is as follows:
$upquery = "UPDATE" #分隔符 @arctype ' SET issend= ' $issend ', sortrank= ' $sortrank ', typename= ' $typename ', typenameng= ' $typenameng ', typedir= ' $typedir ', isdefault= ' $isdefault ', defaultname= ' $ DefaultName ',
Add the red part, the separator 3 characters to remove, so that the addition is complete.
Call Mode:
{Dede:field name= ' Typenameng '/}
You want to use it in the channel, for example
The code is as follows:
{dede:channel type= ' son ' row= ' typeid= ' 1 '} <li><a href= ' [field:typeurl/] ' >[field:typename/][field:typenameng/]</a></li>{/dede: Channel
You also need to modify a file to find the include\taglib\channel.lib.php
First place:
The code is as follows:
if ($type = = ' top ') { $sql = "Select Id,typename,typenameng,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,typenameng,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,typenameng,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From ' #分隔符 @arctype ' WHERE reid= ' $reid ' and ishidden<>1 ORDER by Sortrank ASC limit 0, $line "; }
Second place:
The code is as follows:
If the sub-column mode, when there is no sub-column display if the sibling column if ($type = = ' son ' && $reid!=0 && $totalRow ==0) { $sql = "SELECT ID , Typename,typenameng,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath from ' # Delimiter @arctype ' WHERE reid= ' $reid ' and ishidden<>1 ORDER by Sortrank ASC limit 0, $line "; $dsql->setquery ($sql); $dsql->execute (); }
Add query fields can be used in the channel, as well as type,channelartlist and other tabs are in the corresponding Lib class to add the query field, this is limited to a good detailed description.
Handles the style of the current column in the sibling column. Call in Currentstyle, include\taglib\channel.lib.php 140 lines $linkOkstr = Str_replace ("~typename~", $row [' TypeName '],$ LINKOKSTR); Add the following
$linkOkstr = Str_replace ("~typenameeng~", $row [' Typenameeng '], $linkOkstr);