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

相关案例演示
  {
  $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分类;

免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。


来源:网友投稿 关注: 时间:2020-04-08 08:36
首先声明,只要是我们的vip会员所有源码均可以免费下载,不做任何限制(了解更多)
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
相关织梦教程
QQ在线咨询