Dedecms   发布时间:2022-05-06  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了织梦用栏目分页来做小说站实现教程(支持动态静态)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

前台栏目和分页 后台栏目数据 需求描述 一个栏目就是一个小说,炒鸡轻松实现按栏目分页 不影响程序其他功能文档分页 支持动态、生成静态、伪静态 可扩展其他分页,例如会员分页,自定义表单分页 实现教程 打开 /include/arc.listview.class.php 找到 大概在2

前台栏目和分页

织梦用栏目分页来做小说站实现教程(支持动态静态)

后台栏目数据

织梦用栏目分页来做小说站实现教程(支持动态静态)

需求描述

一个栏目就是一个小说,炒鸡轻松实现按栏目分页

不影响程序其他功能文档分页

支持动态、生成静态、伪静态

可扩展其他分页,例如会员分页自定义表单分页

实现教程

打开 /include/arc.listview.class.PHP 找到 大概在248行

$ctag = $this->dtp->GetTag("page");

在它下面加入

if(!is_object($ctag))
{
	$ctag = $this->dtp->GetTag("listsql");
	if(is_object($ctag))
	{
		$this->addsql = " WHERE ishidden<>1 ";
		if($cfg_list_son=='N')
		{
			if($this->CrossID=='') $this->addsql .= " AND (id='".$this->TypEID."') ";
			else $this->addsql .= " AND (id in({$this->CrossID},{$this->TypEID})) ";
		}
		else
		{
			$sonids = GetSonIds($this->TypEID,$this->Fields['chAnneltype'],0);
			if(!preg_match("/,/",$sonids)) {
				$this->addsql .= " AND id = '$sonids' ";
			}
			else {
				$this->addsql .= " AND id IN($sonids) ";
			}
		}
		$sql = $ctag->GetAtt("sql");
		$sql = preg_replace("/SELECT(.*?)FROM/is"," SELECT count(*) as dd FROM ",$sql);
		$sql = preg_replace("/ORDER(.*?)SC/is","",$sql);
		$sql = $sql.$this->addsql;
		$row = $this->dsql->GetOne($sql);
		if(is_array($row))
		{
			$this->@R_476_10586@lResult = $row['dd'];
		}
		else
		{
			$this->@R_476_10586@lResult = 0;
		}
	}
}

继续找到

else if($ctag->GetName()=="Pagelist")

在它上面加入

else if($ctag->GetName()=="listsql")
{
    $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->GetsqlList(
    $limitstart,$row,$ctag->GetAtt("sql"),$InnerText
    ));
}
继续找到
function GetPagelistST

在它上面加入

function GetsqlList($limitstart = 0,$row = 10,$sql = '',$innertext)
{
    global $cfg_list_son;
    $innertext = trim($innertext);

    if ($innertext == '')
    {
        $innertext = GetSystemplets('list_fulllist.htm');
    }
    //处理sql语句
    $limitStr = " LIMIT {$limitstart},{$row}";
	$sql = $sql.$this->addsql.$limitStr;
    $this->dsql->SetQuery($sql);
    $this->dsql->Execute('al');
    $t2 = Exectime();

    //echo $t2-$t1;
    $sqllist = '';
    $this->dtp2->Loadsource($innertext);
    $GLOBALS['autoindex'] = 0;

    //获取字段
    while($row = $this->dsql->GetArray("al"))
    {
		$row['typeurl'] = GetTypeUrl($row['typEID'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']);
		$row['typelink'] = GetOneTypeUrlA($row);
        $GLOBALS['autoindex']++;
        if(is_array($this->dtp2->CTags))
        {
            foreach($this->dtp2->CTags as $k=>$ctag)
            {
                if($ctag->GetName()=='array')
                {
                    //传递整个数组,在runPHP模式中有特殊作用
                    $this->dtp2->Assign($k,$row);
                }
                else
                {
                    if(isset($row[$ctag->GetName()]))
                    {
                        $this->dtp2->Assign($k,$row[$ctag->GetName()]);
                    }
                    else
                    {
                        $this->dtp2->Assign($k,'');
                    }
                }
            }
        }
        $sqllist .= $this->dtp2->GetResult();
    }//while
    $t3 = Exectime();
    //echo ($t3-$t2);
    $this->dsql->FreeResult('al');
    return $sqllist;
}

注意:上面添加代码,有的是添加上面有的是添加在下面的,看清楚了。

栏目模板标签写法

	

栏目列表

栏目分页

    {dede:Pagelist listitem="info,index,end,pre,next,pageno,option" listsize="5"/}

pagesize="10"  每页显示10个栏目

[field:typelink/]  栏目链接

[field:typename/]    栏目名称

[field:其他字段/]   栏目其他自定义字段都可以直接调用

如果封面频道也要作为最终列表栏目和分页

这个这个文章

https://www.mokuge.com/webdesign/2867.html

改下图那2处

织梦用栏目分页来做小说站实现教程(支持动态静态)

大佬总结

以上是大佬教程为你收集整理的织梦用栏目分页来做小说站实现教程(支持动态静态)全部内容,希望文章能够帮你解决织梦用栏目分页来做小说站实现教程(支持动态静态)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。