Pursuing a dream dedecms calls at the same level column method, using channelartlist call the same column in the list of articles and content pages

 When using dedecms dedecms, want to call peer in the list of article columns and content pages, of course, may be used {dede: channelartlist typeid = '1' row = '5'} method specified column id, but to automatically determine the current section of the column at the same level would not work or need to assign a template for each top-level topic, this is very troublesome. This article will give a more simple way:

1. Locate the \ include \ taglib \ channelartlist.lib.php file
 

Find:

 $attlist = 'typeid|0,row|20,cacheid|'; 

change into:

$attlist = 'typeid|0,row|20,cacheid|,type|';     //这边加个 type 实现 在子栏目下调用   同级子栏目的信息

Then look for:

  1.  
    if($typeid==0 || $typeid=='top') {
  2.  
            $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 ";
  3.  
        }

change into:

  1.  
    IF ($ of the type == 'Reid')     // call the sub-column content under the parent directory
  2.  
          {        
  3.  
            $reid = $refObj->TypeLink->TypeInfos[ 'reid'];          
  4.  
            $tpsql = " reid='$reid' AND ispart<>2 AND ishidden<>1 ";
  5.  
          }
  6.  
        else if($typeid==0 || $typeid=='top') {
  7.  
            $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 ";
  8.  
        }

Save the above file. Then in the list page or use the content page:

  1.  
    {dede:channelartlist type='reid' row='5'}
  2.  
    Underlying loop code
  3.  
    {/dede:channelartlist}  

It can easily call.

Guess you like

Origin www.cnblogs.com/lanne/p/dedecms.html