给DEDECMS栏目增加指定css 样式

/ 0评 / 0

dede_arctype 表里增加一个 classid 字段

可以直接在后台执行SQL

alter table dede_arctype add column classid VARCHAR(50);

dede/catalog_add.php搜索

,`smalltypes`

替换为

,`smalltypes`,`classid`

搜索

'0','','','0','0','0','','')";

替换为

'0','','','0','0','0','','','$classid')"

dede/catalog_edit.php  搜索

typename='$typename',

第一个下边增加

classid='$classid',

/dede/templets/catalog_add.htm 搜索

<td class='bline' height="26" style="padding-left:10px;"><font color='red'>栏目名称:</font></td>
<td class='bline'><input name="typename" type="text" id="typename" size="30" class="iptxt" /></td>
</tr>

下边增加

<tr>
<td class='bline' height="26" style="padding-left:10px;"><font color='red'>栏目样式:</font></td>
<td class='bline'><input name="classid" type="text" id="classid" size="30" value="" class="iptxt" /> </td>
</tr>

/dede/templets/catalog_edit.htm 搜索

<tr>
<td class='bline' height="26" style="padding-left:10px;"><font color='red'>栏目名称:</font></td>
<td class='bline'><input name="typename" type="text" id="typename" size="30" value="<?php echo $myrow['typename']?>" class="iptxt" /></td>
</tr>

在其下方增加

<tr>
<td class='bline' height="26" style="padding-left:10px;"><font color='red'>栏目样式:</font></td>
<td class='bline'><input name="classid" type="text" id="classid" size="30" value="<?php echo $myrow['classid']?>" class="iptxt" /></td>
</tr>

/include/taglib/channel.lib.php搜索

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

替换为

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

搜索

$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";

替换为

$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,jjm,boxid
FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";

搜索

$linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);

在其下方增加

$linkOkstr = str_replace("~classid~",$row['classid'],$linkOkstr);

模板中调用

{dede:channel type='top' row='9'}
<li id="menu-item" class="[field:classid/]">
<a href="[field:typeurl/]">[field:typename/]</a>
</li>
{/dede:channel}

直接在后台修改栏目中写上css的名称
例如 栏目1 栏目样式:classa

style

.classa {..........}

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注