Bilingual navigation : Let's start to make the DedeCMS navigation menu display English column names at the same time. Sometimes the website needs English column names, so today I will tell you how to add them. It is also a small secondary development.

Let's see the effect first.

 Bilingual navigation

First give the dede_arctype Add a field to the table. The prefix in front of the table is the name of your site, not necessarily dede_

The effect after adding is as shown in the figure above. Field adding method《 》。 Among them, typenameng is the field I added. The name is a bit long. Of course, you can change it to the name you like, which does not hurt elegance.

Find catalog_edit.htm in the dede (background) emplets directory

Found:

<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" value="<?php echo $myrow['typename']?>" class="iptxt" /></td>
</tr>

Add below:

<tr>
<td class='bline 'height="26" style="padding left: 10px;">Column English name:</td>
<td class='bline'><input name="typenameng" type="text" id="typenameng" size="30" value="<?php echo $myrow['typenameng']?>" class="iptxt" /></td>
</tr>

Finally, we open dedecatalog_edit.php

Found:

$upquery = "UPDATE `dede_arctype` SET
issend='$issend',
sortrank='$sortrank',
typename='$typename',
typenameng='$typenameng',
typedir='$typedir',
isdefault='$isdefault',
defaultname='$defaultname',

Add the red part, and the three characters of the separator will be removed automatically. So far, the addition is complete.

Call method:

{dede:field name='typenameng'/}

To use in the channel, for example:

{dede:channel type='son' row='10' typeid='1'}
<li><a href='[field:typeurl/]'>[field:typename/][field:typenameng/]</a></li>
{/dede:channel}

Then modify a file and find include aglibchannel.lib.php

First place:

if($type=='top')
{
$sql = "SELECT id,typename,typenameng,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
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,typenameng,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
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,typenameng,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
}

Second place:

//If sub column mode is used, the same level columns will be displayed when there are no sub columns
if($type=='son' && $reid!=0 && $totalRow==0)
{
$sql = "SELECT id,typename,typenameng,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
$dsql->SetQuery($sql);
$dsql->Execute();
}

Adding query fields can be used in the channel. In addition, the type, channelartlist and other tabs add query fields in the corresponding lib class, which will be described in detail due to space limitations.

Post reply

Can't comment until