dedecms 实现织梦搜索页面调用 文章功能
直接进入主题,今天使用dedecms织梦开源系统做企业网站,要实现在搜索页面里调用推荐新闻的,但是dedecms织梦在搜索页面里不可以直接使用以下代码调用文章的:
{dede:arclist flag= 'c' titlelen=42 row=6} [field:title/] [field:description function = 'cn_substr(@me,80)' /]... {/dede:arclist}如是笔者硬是把搜索页面的内核代码完全的看了一遍,终于实现了搜索页面调用[推荐文章].
为什么搜索页面不能调用新闻呢,下面我来告诉大家,找到arc.searchview.class.php文件,看以下代码:
function Display() { foreach ( $this ->dtp->CTags as $tagid => $ctag ) { $tagname = $ctag ->GetName(); if ( $tagname == "list" ) { $limitstart = ( $this ->PageNo-1) * $this ->PageSize; $row = $this ->PageSize; if (trim( $ctag ->GetInnerText())== "" ) { $InnerText = GetSysTemplets( "list_fulllist.htm" ); } else { $InnerText = trim( $ctag ->GetInnerText()); } $this ->dtp->Assign( $tagid , $this ->GetArcList( $limitstart , $row , $ctag ->GetAtt( "col" ), $ctag ->GetAtt( "titlelen" ), $ctag ->GetAtt( "infolen" ), $ctag ->GetAtt( "imgwidth" ), $ctag ->GetAtt( "imgheight" ), $this ->ChannelType, $this ->OrderBy, $InnerText , $ctag ->GetAtt( "tablewidth" )) ); } else if ( $tagname == "pagelist" ) { $list_len = trim( $ctag ->GetAtt( "listsize" )); if ( $list_len == "" ) { $list_len = 3; } $this ->dtp->Assign( $tagid , $this ->GetPageListDM( $list_len )); } else if ( $tagname == "likewords" ) { $this ->dtp->Assign( $tagid , $this ->GetLikeWords( $ctag ->GetAtt( 'num' ))); } else if ( $tagname == "hotwords" ) { $this ->dtp->Assign( $tagid ,lib_hotwords( $ctag , $this )); } else if ( $tagname == "field" ) { //类别的指定字段 if (isset( $this ->Fields[ $ctag ->GetAtt( 'name' )])) { $this ->dtp->Assign( $tagid , $this ->Fields[ $ctag ->GetAtt( 'name' )]); } else { $this ->dtp->Assign( $tagid , "" ); } } else if ( $tagname == "channel" ) { //下级频道列表 if ( $this ->TypeID>0) { $typeid = $this ->TypeID; $reid = $this ->TypeLink->TypeInfos[ 'reid' ]; } else { $typeid = 0; $reid =0; } $GLOBALS [ 'envs' ][ 'typeid' ] = $typeid ; $GLOBALS [ 'envs' ][ 'reid' ] = $typeid ; $this ->dtp->Assign( $tagid ,lib_channel( $ctag , $this )); } //End if elseif ( $tagname == "arclist" ) //这是笔者自己加的代码只要加上这行代码我们就能调用[acrlist]标签 { MakeOneTag( $this ->dtp, $this ); } //开源软件:phpfensi测试数据 } global $keyword , $oldkeyword ; if (! empty empty ( $oldkeyword )) $keyword = $oldkeyword ; $this ->dtp->Display(); }只要把代码中加注释的那段语句加入arc.searchview.class.php文件里就可以实现搜索页面调用文章.
查看更多关于dedecms 实现织梦搜索页面调用 文章功能 - DeDecms的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did5883