M1850资源网 - 最专业的网站源码模板下载站!

全部作品
全部作品
织梦模板
网站模板
源码插件
游戏源码
脚本特效
视频教程
建站教程
M1850资源网 > 建站教程 > 织梦教程 > 织梦安装 > 解决dede 5.7 三级目录、侧导航的调用

推荐下载

解决dede 5.7 三级目录、侧导航的调用

  1、找到 include/taglib/channel.lib.php 文件,用下面代码替换这个文件里面的所有内容,以免出错,请先备份一下原文件。

  (由于网页编码问题,复制了以后内容还不能直接用的。要注意里面的符号。)

  CAttribute->Items,$attlist);

  extract($ctag->CAttribute->Items, EXTR_SKIP);

  $innertext = $ctag->GetInnerText();

  $cacheid = trim($cacheid);

  if($cacheid !='') {

  $likeType = GetCacheBlock($cacheid);

  if($likeType != '') return $likeType;

  }

  $reid = 0;

  $topid = 0;

  if(empty($typeid) && $envs['typeid']!=0)

  {

  $typeid = $envs['typeid'];

  $reid = $envs['reid'];

  }else{

  $reid=0;

  }

  if($type==''||$type=='sun') $type="son";

  if($innertext=='') $innertext = GetSysTemplets("channel_list.htm");

  if($reid==0 && $typeid>0)

  {

  $dbrow = $dsql->GetOne("Select reid From dede_arctype where id='$typeid' ");

  if(is_array($dbrow)) $reid = $dbrow['reid'];

  }

  $likeType = '';

  if($type=='top')

  {

  $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

  From dede_arctype where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row";

  }

  else if($type=="son")

  {

  //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];

  if($typeid==0) {

  return '';

  }

  $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

  From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";

  }

  else if($type=="self")

  {

  if($reid==0) {

  return '';

  }

  $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

  From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";

  }

  //And id<>'$typeid'

  $needRel = false;

  $dtp2 = new DedeTagParse();

  $dtp2->SetNameSpace("field","[","]");

  $dtp2->LoadSource($innertext);

  $dsql2 = clone $dsql;

  $dsql->SetQuery($sql);

  $dsql->Execute();

  $line = $row;

  //检查是否有子栏目,并返回rel提示(用于二级菜单)

  if(ereg(':rel', $innertext)) $needRel = true;

  if(empty($sql)) return '';

  $dsql->SetQuery($sql);

  $dsql->Execute();

  $totalRow = $dsql->GetTotalRow();

  $GLOBALS['autoindex'] = 0;

  for($i=0;$i < $line;$i++) { if($col>1) $likeType .= "

  \r\n";

  for($j=0;$j<$col;$j++) { if($col>1) $likeType .= "

  \r\n";

  if($row=$dsql->GetArray())

  {

  $row['sonids'] = $row['rel'] = '';

  if($needRel)

  {

  $row['sonids'] = GetSonIds($row['id'], 0, false);

  if($row['sonids']=='') $row['rel'] = '';

  else $row['rel'] = " rel='dropmenu{$row['id']}'";

  }

  //处理同级栏目中,当前栏目的样式

  if( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' )

  {

  if($currentstyle!='')

  {

  $linkOkstr = $currentstyle;

  $row['typelink'] = GetOneTypeUrlA($row);

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

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

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

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

  $likeType .= $linkOkstr;

  }

  }else

  {

  $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);

  if(is_array($dtp2->CTags))

  {

  foreach($dtp2->CTags as $tagid=>$ctag){

  if(isset($row[$ctag->GetName()]))

  {

  $dtp2->Assign($tagid,$row[$ctag->GetName()]);

  }

  elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))

  {

  $dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql2));

  }

  }

  }

  $likeType .= $dtp2->GetResult();

  }

  }

  if($col>1) $likeType .= "

  \r\n";

  $GLOBALS['autoindex']++;

  }//Loop Col

  if($col>1)

  {

  $i += $col - 1;

  $likeType .= "

  \r\n";

  }

  }//Loop for $i

  reset($dsql2);

  $dsql->FreeResult();

  return $likeType;

  }

  function lib_channel_son($ctag,$typeid = 0,$dsql2)

  {

  $attlist = "row|100,col|1,currentstyle|";

  FillAttsDefault($ctag->CAttribute->Items,$attlist);

  extract($ctag->CAttribute->Items, EXTR_SKIP);

  $innertext = $ctag->GetInnerText();

  $dsql3 = clone $dsql2;

  $likeType = '';

  //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];

  if($typeid==0) {

  return '';

  }

  $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

  From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";

  //And id<>'$typeid'

  $dtp2 = new DedeTagParse();

  $dtp2->SetNameSpace("field","[","]");

  $dtp2->LoadSource($innertext);

  $dsql2->SetQuery($sql);

  $dsql2->Execute();

  $line = $row;

  for($i=0;$i < $line;$i++) { if($col>1) $likeType .= "

  \r\n";

  for($j=0;$j<$col;$j++) { if($col>1) $likeType .= "

  \r\n";

  if($row=$dsql2->GetArray())

  {

  $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);

  if(is_array($dtp2->CTags))

  {

  foreach($dtp2->CTags as $tagid=>$ctag){

  if(isset($row[$ctag->GetName()]))

  {

  $dtp2->Assign($tagid,$row[$ctag->GetName()]);

  }

  elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))

  {

  $dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql3));

  }

  }

  }

  $likeType .= $dtp2->GetResult();

  }

  if($col>1) $likeType .= "

  \r\n";

  }//Loop Col

  if($col>1)

  {

  $i += $col - 1;

  $likeType .= "

  \r\n";

  }

  }//Loop for $i

  reset($dsql3);

  $dsql2->FreeResult();

  return $likeType;

  }

  ?>2、将以下内容复制到你需要调用的模板中。

  Products List

  //导航此处才开始

  {dede:channelartlist typeid='top' row='8'}

  {dede:field name='typename'/}

  {dede:channel type='son'}//注意:此处不要加typeid函数,不然它会只调用你指定的ID分类;

  [field:typename/]

  [field:sonchannel0]

  [field:typename/]

  [field:sonchannel1]

  ---[field:typename/]

  [field:sonchannel2]

  ===[field:typename/]

  [field:sonchannel3]

  ===[field:typename/]

  [/field:sonchannel3]

  [/field:sonchannel2]

  [/field:sonchannel1]

  [/field:sonchannel0]

  {/dede:channel}

  {/dede:channelartlist}CSS样式,需要的拿去

  .l_nav{ width:240px;}

  .l_title{ width:240px; padding-bottom:10px; background:url(../images/left_nav_bth.png) center bottom no-repeat; font-size:22px; color:#333; text-align:center; text-shadow: 0 1px #FFFFFF; font-weight:bold; margin-top: 20px;}

  .l_nav a{ color:#555; text-decoration:none; line-height:25px;}

  .l_nav li:hover { background:#f1f1f1; border:1px solid #fff; padding:4px 0 4px 9px;}

  .l_nav li:hover a, .pright_l_nav li ul li:hover a{}

  .l_nav li:hover ul a{ color:#333;}

  .l_nav li ul li:hover a{ color:#fff; text-shadow:none;}

  .l_nav li { width:200px; height:25px; padding:5px 0 5px 10px; text-shadow:0 1px #fff;}

  .l_nav ul{ padding-left:20px; width:200px;}

  .l_nav ul.nav2{ font-size:11px; padding-left:0px; position:absolute; margin-top:-2000px; margin-left:140px; background:#eee; box-shadow: 4px 4px 6px #999999; -moz-box-shadow: 4px 4px 6px #999999;}

  .l_nav ul.nav2 li{ padding-left:10px; height:25px; list-style:none; margin-left:-5px; }

  .l_nav ul.nav2 li:hover{ background:#333; padding-left:-5px; }

  .l_nav li:hover ul.nav2{ margin-top:-30px; }

  .pright_l_nav ul.nav2 li:hover a{ font-weight:bold;}

  .pright_l_nav ul.nav3{ margin-top:-2000px; margin-left:140px; background:#999; }

  .pright_l_nav ul.nav2 li:hover ul{ margin-top:-30px; padding-left:0;}

  .pright_l_nav ul.nav3 li:hover{ margin-left:-5px; background:#000;}

嘿,我来帮您!

展开