织梦cms

推荐列表 站点导航

当前位置:首页 > 建站教程 > 织梦cms >

DEDE5.6,DEDE5.7实现同时调用一级、二级、三级栏目

来源:网络整理  作者:  发布时间:2020-12-14 05:03
一、修改文件:\include\taglib目录下的channel.lib.php,请将以下代码全部复制替换上述文件 ?php function lib_channel( $ctag , $...
                    $linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr);
    $dtp2->SetNameSpace("field","[","]");
        if($reid==0) {
    FillAttsDefault($ctag->CAttribute->Items,$attlist);
                        }
        if($col>1)
                }
        {
        if(is_array($dbrow)) $reid = $dbrow['reid'];
    $dsql->FreeResult();
              [field:typename/]
        //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
                {
                    {
                    </ul>
    $dsql->SetQuery($sql);
                    $linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr);
    global $_sys_globals,$envs,$dsql;
          From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
 {/dede:channel}

                    if(is_array($dtp2->CTags))
    for($i=0;$i < $line;$i++)
        $reid = $envs['reid'];
    reset($dsql3);

模板调用    [field:sonchannel0] [/field:sonchannel0] 这个是用来取子栏目用得(使用[sonchannel+数字] 作为标签名是为了防止嵌套的时候无法正确解析标签)

                            <li><href="dede58.com/[field:typelink/]">===[field:typename/]</a></li>
                    [field:sonchannel0]
    //And id<>'$typeid'
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    }
        //检查是否有子栏目,并返回rel提示(用于二级菜单)

一、修改文件:\include\taglib目录下的channel.lib.php,请将以下代码全部复制替换上述文件

    }
                             [field:sonchannel2]
                if(is_array($dtp2->CTags))
        $likeType = GetCacheBlock($cacheid);
    else if($type=="self")

                            $row['sonids'] = $row['rel'] = '';
    {
            if($col>1) $likeType .= "</dd>\r\n";
                {
            $likeType .= "    </dl>\r\n";
            $i += $col - 1;
        }//Loop Col
            $GLOBALS['autoindex']++;
    $dsql2->Execute();
        if($likeType != '') return $likeType;
            $i += $col - 1;
                }
        }
                            if(isset($row[$ctag->GetName()]))
    //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
                    $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
                    $row['sonids'] = GetSonIds($row['id'], 0, false);
    if($cacheid !='') {
            From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";
                                <li><href="dede58.com/[field:typelink/]">===[field:typename/]</a></li>
                            {
                        <li><href="dede58.com/[field:typelink/]">---[field:typename/]</a></li>
        if($typeid==0) {
                    <li><href="[field:typelink/]">[field:typename/]</a></li>
        }
function lib_channel(&$ctag,&$refObj)
                        foreach($dtp2->CTags as $tagid=>$ctag){
                            }
    $dsql2 = clone $dsql;

                            $dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql3));
            return '';
        for($j=0;$j<$col;$j++)
    $needRel = false;
{

{dede:channel type='son' typeid='22'}
            {
        $cacheid = trim($cacheid);
                                $dtp2->Assign($tagid,$row[$ctag->GetName()]);
                {
            return '';
    }
                             [/field:sonchannel2]
        $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
    $line = $row;
                    }
                            elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))
    else if($type=="son")
                            {
    $dsql2->SetQuery($sql);
            if($col>1) $likeType .= "</dd>\r\n";
                }
    if($type==''||$type=='sun') $type="son";
    $dtp2->SetNameSpace("field","[","]");
          From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
    }
    }
                if( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' )
    $likeType = '';
    if(empty($typeid) && $envs['typeid']!=0)
                         [/field:sonchannel1]
                        {
    if($type=='top')
    $attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|";
    }//Loop for $i
            }
function lib_channel_son($ctag,$typeid = 0,$dsql2)
                            $dtp2->Assign($tagid,$row[$ctag->GetName()]);
    if($typeid==0) {

    $line = $row;
    return $likeType;
          From dede_arctype where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row";
                    <ul>
            if($row=$dsql2->GetArray())
                    $row['typelink'] = GetOneTypeUrlA($row);

        if($col>1) $likeType .= "<dl>\r\n";
    $topid = 0;
    if($reid==0 && $typeid>0)
        }
                if($needRel)
                    else $row['rel'] = " rel='dropmenu{$row['id']}'";

<?php

这个的作用就是当你的栏目有很多子栏目 无限分级的时候方便你取子栏目的

    $totalRow = $dsql->GetTotalRow();
                    $likeType .= $dtp2->GetResult();
            $likeType .= "    </dl>\r\n";
        $reid=0;
                    if($currentstyle!='')
                                $dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql2));
                {
    }

二、在模板调用
    $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
                        if(isset($row[$ctag->GetName()]))
                //处理同级栏目中,当前栏目的样式
                        elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))
    $dtp2 = new DedeTagParse();
                }else
    if(ereg(':rel', $innertext)) $needRel = true;
?>

    if(empty($sql)) return '';
    $GLOBALS['autoindex'] = 0;
    $reid = 0;
    return $likeType;
    //And id<>'$typeid'
                    }
    $dsql2->FreeResult();
    $dsql->Execute();
            if($col>1) $likeType .= "<dd>\r\n";
    $dsql->Execute();
    {
    }else{
    }

}
        $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
                         [field:sonchannel1]
实例:

    {
    reset($dsql2);
                        }
    $likeType = '';
        {
                            }
        if($col>1) $likeType .= "<dl>\r\n";
    for($i=0;$i < $line;$i++)
                    }
                    $linkOkstr = $currentstyle;
        }
                    foreach($dtp2->CTags as $tagid=>$ctag){
            if($col>1) $likeType .= "<dd>\r\n";
                    $likeType .= $linkOkstr;
                $likeType .= $dtp2->GetResult();
        for($j=0;$j<$col;$j++)
        return '';
    {
    {
        if($col>1)
        $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
   
    $dtp2->LoadSource($innertext);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $dsql3 = clone $dsql2;
                    [/field:sonchannel0]
   
                        {
                        }
    $dsql->SetQuery($sql);
    $dtp2->LoadSource($innertext);

    {
    $innertext = $ctag->GetInnerText();
            if($row=$dsql->GetArray())
                    $linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
            {
        }//Loop Col
}
            }
        $typeid = $envs['typeid'];
    $innertext = $ctag->GetInnerText();
        $dbrow = $dsql->GetOne("Select reid From dede_arctype where id='$typeid' ");
{
    {
        {
    $dtp2 = new DedeTagParse();
    if($innertext=='') $innertext = GetSysTemplets("channel_list.htm");
                                [field:sonchannel3]
                $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
        {
                    {
    $attlist = "row|100,col|1,currentstyle|";
                    $linkOkstr = str_replace("~id~",$row['id'],$linkOkstr);
                    if($row['sonids']=='') $row['rel'] = '';
    }//Loop for $i
                                 [/field:sonchannel3]
    FillAttsDefault($ctag->CAttribute->Items,$attlist);

相关热词: 调用 dede

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://www.juheyunku.com/jz/dedecms/3624.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

DEDE5.6,DEDE5.7实现同时调用一级、二级、三级栏目

2020-12-14 编辑:

                    $linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr);
    $dtp2->SetNameSpace("field","[","]");
        if($reid==0) {
    FillAttsDefault($ctag->CAttribute->Items,$attlist);
                        }
        if($col>1)
                }
        {
        if(is_array($dbrow)) $reid = $dbrow['reid'];
    $dsql->FreeResult();
              [field:typename/]
        //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
                {
                    {
                    </ul>
    $dsql->SetQuery($sql);
                    $linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr);
    global $_sys_globals,$envs,$dsql;
          From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
 {/dede:channel}

                    if(is_array($dtp2->CTags))
    for($i=0;$i < $line;$i++)
        $reid = $envs['reid'];
    reset($dsql3);

模板调用    [field:sonchannel0] [/field:sonchannel0] 这个是用来取子栏目用得(使用[sonchannel+数字] 作为标签名是为了防止嵌套的时候无法正确解析标签)

                            <li><href="dede58.com/[field:typelink/]">===[field:typename/]</a></li>
                    [field:sonchannel0]
    //And id<>'$typeid'
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    }
        //检查是否有子栏目,并返回rel提示(用于二级菜单)

一、修改文件:\include\taglib目录下的channel.lib.php,请将以下代码全部复制替换上述文件

    }
                             [field:sonchannel2]
                if(is_array($dtp2->CTags))
        $likeType = GetCacheBlock($cacheid);
    else if($type=="self")

                            $row['sonids'] = $row['rel'] = '';
    {
            if($col>1) $likeType .= "</dd>\r\n";
                {
            $likeType .= "    </dl>\r\n";
            $i += $col - 1;
        }//Loop Col
            $GLOBALS['autoindex']++;
    $dsql2->Execute();
        if($likeType != '') return $likeType;
            $i += $col - 1;
                }
        }
                            if(isset($row[$ctag->GetName()]))
    //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
                    $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
                    $row['sonids'] = GetSonIds($row['id'], 0, false);
    if($cacheid !='') {
            From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";
                                <li><href="dede58.com/[field:typelink/]">===[field:typename/]</a></li>
                            {
                        <li><href="dede58.com/[field:typelink/]">---[field:typename/]</a></li>
        if($typeid==0) {
                    <li><href="[field:typelink/]">[field:typename/]</a></li>
        }
function lib_channel(&$ctag,&$refObj)
                        foreach($dtp2->CTags as $tagid=>$ctag){
                            }
    $dsql2 = clone $dsql;

                            $dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql3));
            return '';
        for($j=0;$j<$col;$j++)
    $needRel = false;
{

{dede:channel type='son' typeid='22'}
            {
        $cacheid = trim($cacheid);
                                $dtp2->Assign($tagid,$row[$ctag->GetName()]);
                {
            return '';
    }
                             [/field:sonchannel2]
        $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
    $line = $row;
                    }
                            elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))
    else if($type=="son")
                            {
    $dsql2->SetQuery($sql);
            if($col>1) $likeType .= "</dd>\r\n";
                }
    if($type==''||$type=='sun') $type="son";
    $dtp2->SetNameSpace("field","[","]");
          From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
    }
    }
                if( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' )
    $likeType = '';
    if(empty($typeid) && $envs['typeid']!=0)
                         [/field:sonchannel1]
                        {
    if($type=='top')
    $attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|";
    }//Loop for $i
            }
function lib_channel_son($ctag,$typeid = 0,$dsql2)
                            $dtp2->Assign($tagid,$row[$ctag->GetName()]);
    if($typeid==0) {

    $line = $row;
    return $likeType;
          From dede_arctype where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row";
                    <ul>
            if($row=$dsql2->GetArray())
                    $row['typelink'] = GetOneTypeUrlA($row);

        if($col>1) $likeType .= "<dl>\r\n";
    $topid = 0;
    if($reid==0 && $typeid>0)
        }
                if($needRel)
                    else $row['rel'] = " rel='dropmenu{$row['id']}'";

<?php

这个的作用就是当你的栏目有很多子栏目 无限分级的时候方便你取子栏目的

    $totalRow = $dsql->GetTotalRow();
                    $likeType .= $dtp2->GetResult();
            $likeType .= "    </dl>\r\n";
        $reid=0;
                    if($currentstyle!='')
                                $dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql2));
                {
    }

二、在模板调用
    $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
                        if(isset($row[$ctag->GetName()]))
                //处理同级栏目中,当前栏目的样式
                        elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))
    $dtp2 = new DedeTagParse();
                }else
    if(ereg(':rel', $innertext)) $needRel = true;
?>

    if(empty($sql)) return '';
    $GLOBALS['autoindex'] = 0;
    $reid = 0;
    return $likeType;
    //And id<>'$typeid'
                    }
    $dsql2->FreeResult();
    $dsql->Execute();
            if($col>1) $likeType .= "<dd>\r\n";
    $dsql->Execute();
    {
    }else{
    }

}
        $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
                         [field:sonchannel1]
实例:

    {
    reset($dsql2);
                        }
    $likeType = '';
        {
                            }
        if($col>1) $likeType .= "<dl>\r\n";
    for($i=0;$i < $line;$i++)
                    }
                    $linkOkstr = $currentstyle;
        }
                    foreach($dtp2->CTags as $tagid=>$ctag){
            if($col>1) $likeType .= "<dd>\r\n";
                    $likeType .= $linkOkstr;
                $likeType .= $dtp2->GetResult();
        for($j=0;$j<$col;$j++)
        return '';
    {
    {
        if($col>1)
        $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
   
    $dtp2->LoadSource($innertext);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $dsql3 = clone $dsql2;
                    [/field:sonchannel0]
   
                        {
                        }
    $dsql->SetQuery($sql);
    $dtp2->LoadSource($innertext);

    {
    $innertext = $ctag->GetInnerText();
            if($row=$dsql->GetArray())
                    $linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
            {
        }//Loop Col
}
            }
        $typeid = $envs['typeid'];
    $innertext = $ctag->GetInnerText();
        $dbrow = $dsql->GetOne("Select reid From dede_arctype where id='$typeid' ");
{
    {
        {
    $dtp2 = new DedeTagParse();
    if($innertext=='') $innertext = GetSysTemplets("channel_list.htm");
                                [field:sonchannel3]
                $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
        {
                    {
    $attlist = "row|100,col|1,currentstyle|";
                    $linkOkstr = str_replace("~id~",$row['id'],$linkOkstr);
                    if($row['sonids']=='') $row['rel'] = '';
    }//Loop for $i
                                 [/field:sonchannel3]
    FillAttsDefault($ctag->CAttribute->Items,$attlist);

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://www.juheyunku.com/jz/dedecms/3624.shtml

相关文章

风云图片

推荐阅读

返回织梦cms频道首页