网页特效代码_站长素材站移动版

DeDecms教程

主页 > CMS教程 > DeDecms教程 >

让dedecms织梦dede:list列表页支持flag属性调用文档的方法

修改文件或者直接下载文章结尾处的文件覆盖,覆盖之前请先备份原来的文件。
打开 include/arc.listview.class.php 找到,大概在45行
var $remoteDir;
//在它下面加入一行
var $Flag;
 
//继续找到
$this->remoteDir = '';
//在它下面加入一行
$this->Flag = '';
 
继续找到,大概在227行 至 267行的全部
        //初始化列表模板,并统计页面总数
        $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist'];
        $tempfile = str_replace("{tid}", $this->TypeID, $tempfile);
        $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile);
        if ( defined('DEDEMOB') )
        {
            $tempfile =str_replace('.htm','_m.htm',$tempfile);
        }
        if(!file_exists($tempfile))
        {
            $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_default.htm";
            if ( defined('DEDEMOB') )
            {
                $tempfile =str_replace('.htm','_m.htm',$tempfile);
            }
        }
        
        if(!file_exists($tempfile)||!is_file($tempfile))
        {
            echo "模板文件不存在,无法解析文档!";
            exit();
        }
        $this->dtp->LoadTemplate($tempfile);
        $ctag = $this->dtp->GetTag("page");
        if(!is_object($ctag))
        {
            $ctag = $this->dtp->GetTag("list");
        }
        if(!is_object($ctag))
        {
            $this->PageSize = 20;
        }
        else
        {
if($ctag->GetAtt("flag")!="")
{
$this->Flag = 1;
$flags = explode(',', $ctag->GetAtt("flag"));
for($i=0; isset($flags[$i]); $i++) $this->addSql .= " AND FIND_IN_SET('{$flags[$i]}', arc.flag)>0 ";
}
            if($ctag->GetAtt("pagesize")!="")
            {
                $this->PageSize = $ctag->GetAtt("pagesize");
            }
            else
            {
                $this->PageSize = 20;
            }
        }
把他们剪切放到,大概在155行的下面
$this->addSql  = " arc.arcrank > -1 ";
放它的下面来
 
//继续找到
if($ctag->GetAtt("pagesize")!="")
//在它上面加入
if($ctag->GetAtt("flag")!="")
{
$this->Flag = 1;
$flags = explode(',', $ctag->GetAtt("flag"));
for($i=0; isset($flags[$i]); $i++) $this->addSql .= " AND FIND_IN_SET('{$flags[$i]}', arc.flag)>0 ";
}
 
//继续找到
$row = $this->dsql->GetOne($cquery);
//在它上面加入
if($this->Flag != "")
{
$cquery = "SELECT COUNT(*) AS dd FROM `#【分隔符】@__archives` arc WHERE ".$this->addSql;
}
 
//最后找到
if(preg_match('/hot|click|lastpost/', $orderby))
//改成
if(preg_match('/hot|click|lastpost|weight/', $orderby) || $this->Flag != "")
 
栏目列表页flag标签的写法
{dede:list pagesize='10' titlelen='250' flag='a,p'}
列表内容...
{/dede:list}

(责任编辑:admin)

    468x60