当前位置:首页 > CMS教程 > DeDecms > 列表

dedecms 实现织梦搜索页面调用 文章功能

发布:smiling 来源: PHP粉丝网  添加日期:2014-11-07 10:41:55 浏览: 评论:0 

直接进入主题,今天使用dedecms织梦开源系统做企业网站,要实现在搜索页面里调用推荐新闻的,但是dedecms织梦在搜索页面里不可以直接使用以下代码调用文章的:

  1. {dede:arclist flag='c' titlelen=42 row=6} 
  2. [field:title/]  
  3. [field:description function='cn_substr(@me,80)'/]... 
  4. {/dede:arclist} 

如是笔者硬是把搜索页面的内核代码完全的看了一遍,终于实现了搜索页面调用“推荐文章”.

为什么搜索页面不能调用新闻呢,下面我来告诉大家,找到arc.searchview.class.php文件,看以下代码:

  1. function Display() 
  2.     { 
  3.  
  4.         foreach($this->dtp->CTags as $tagid=>$ctag
  5.         { 
  6.             $tagname = $ctag->GetName(); 
  7.             if($tagname=="list"
  8.             { 
  9.                 $limitstart = ($this->PageNo-1) * $this->PageSize; 
  10.                 $row = $this->PageSize; 
  11.                 if(trim($ctag->GetInnerText())==""
  12.                 { 
  13.                     $InnerText = GetSysTemplets("list_fulllist.htm"); 
  14.                 } 
  15.                 else 
  16.                 { 
  17.                     $InnerText = trim($ctag->GetInnerText()); 
  18.                 } 
  19.                 $this->dtp->Assign($tagid
  20.                 $this->GetArcList($limitstart
  21.                 $row
  22.                 $ctag->GetAtt("col"), 
  23.                 $ctag->GetAtt("titlelen"), 
  24.                 $ctag->GetAtt("infolen"), 
  25.                 $ctag->GetAtt("imgwidth"), 
  26.                 $ctag->GetAtt("imgheight"), 
  27.                 $this->ChannelType, 
  28.                 $this->OrderBy, 
  29.                 $InnerText
  30.                 $ctag->GetAtt("tablewidth")) 
  31.                 ); 
  32.             } 
  33.             else if($tagname=="pagelist"
  34.             { 
  35.                 $list_len = trim($ctag->GetAtt("listsize")); 
  36.                 if($list_len==""
  37.                 { 
  38.                     $list_len = 3; 
  39.                 } 
  40.                 $this->dtp->Assign($tagid,$this->GetPageListDM($list_len)); 
  41.             } 
  42.             else if($tagname=="likewords"
  43.             { 
  44.                 $this->dtp->Assign($tagid,$this->GetLikeWords($ctag->GetAtt('num'))); 
  45.             } 
  46.             else if($tagname=="hotwords"
  47.             { 
  48.                 $this->dtp->Assign($tagid,lib_hotwords($ctag,$this)); 
  49.             } 
  50.             else if($tagname=="field"
  51.             { 
  52.                 //类别的指定字段 
  53.                 if(isset($this->Fields[$ctag->GetAtt('name')])) 
  54.                 { 
  55.                     $this->dtp->Assign($tagid,$this->Fields[$ctag->GetAtt('name')]); 
  56.                 } 
  57.                 else 
  58.                 { 
  59.                     $this->dtp->Assign($tagid,""); 
  60.                 } 
  61.             } 
  62.             else if($tagname=="channel"
  63.             { 
  64.                 //下级频道列表 
  65.                 if($this->TypeID>0) 
  66.                 { 
  67.                     $typeid = $this->TypeID; $reid = $this->TypeLink->TypeInfos['reid']; 
  68.                 } 
  69.                 else 
  70.                 { 
  71.                     $typeid = 0; $reid=0; 
  72.                 } 
  73.                 $GLOBALS['envs']['typeid'] = $typeid
  74.                 $GLOBALS['envs']['reid'] = $typeid
  75.                 $this->dtp->Assign($tagid,lib_channel($ctag,$this)); 
  76.             }//End if 
  77.       elseif($tagname=="arclist")//这是笔者自己加的代码只要加上这行代码我们就能调用“acrlist”标签 
  78.      { 
  79.      
  80.       MakeOneTag($this->dtp,$this); 
  81.      }//开源软件:phpfensi.com 
  82.         } 
  83.         global $keyword,  $oldkeyword
  84.         if(!emptyempty($oldkeyword)) $keyword = $oldkeyword
  85.         $this->dtp->Display(); 
  86.     } 

只要把代码中加注释的那段语句加入arc.searchview.class.php文件里就可以实现搜索页面调用文章.

Tags: dedecms搜索页面 dedecms调用 文章

分享到: