您现在的位置是:首页 > 网站建设网站建设

有谁知道dedecms列表分页的当前页怎么设置的吗

江湖快报网2023-05-10 09:46:25【网站建设】人已围观

简介在后台设置:
方法1、系统---系统基本参数---性能选项---文章自动分页大小(单位: K): 设置文字的量就可以了。
方法2、还可以在后台发布文章的时候,用编辑器的分页标示 #p#副标

在后台设置:
方法1、系统---系统基本参数---性能选项---文章自动分页大小(单位: K): 设置文字的量就可以了。
方法2、还可以在后台发布文章的时候,用编辑器的分页标示 #p#副标题#e#

dedecms分页(列表分页、内容分页),关于分页后的列表页和内容页的标题、关键词、描述的重复问题。

这个无法实现的
因为 dedecms 没有 也不可能提供 分页 关键词 与描述 设置


内容分页后,发现第一页是有标题、关键词和页面描述的,第二页或者后几页是没有页面描述,标题没有一致(加了页面序号),但关键词是一致的。
这些官方都是为了seo 考虑的

dede会员列表调用。。。有办法实现分页吗?请细说。。

一种方法是调用栏目


<h5><a href=[field:arcurl/]>[field:title/]</a></h5>
<p> [field:info/]...<a href=[field:arcurl/]>...</a></p>


第二种方法是排序方式


<h5><a href=[field:arcurl/]>[field:title/]</a></h5>
<p> [field:info/]...<a href=[field:arcurl/]>...</a></p>

织梦dede:sql语句在内容页调用列表时怎么分页

我们可以另外嵌入一个类似{dede:listsql sql='select * from wp_posts' pagesize='10'}的标签来使用。

OK,思路已经有了,接下来我们打开include/arc.listview.class.php这个文件来给它动个小手术吧!

找到:

if(!is_object($ctag)) { $ctag = $this->dtp->GetTag(list); }
这一段,在其后添加如下代码:

if(!is_object($ctag)) { $ctag = $this->dtp->GetTag(listsql); if (is_object($ctag)) { $cquery = $ctag->GetAtt(sql); $cquery = preg_replace(/SELECT(.*?)FROM/is, SELECT count(*) as dd FROM , $cquery); $cquery = preg_replace(/ORDER(.*?)SC/is, , $cquery); $row = $this->dsql->GetOne($cquery); if(is_array($row)) { $this->TotalResult = $row['dd']; } else { $this->TotalResult = 0; } } } //end

然后找到:

if($ctag->GetName()==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), $ctag->GetAtt(listtype), $ctag->GetAtt(orderby), $InnerText, $ctag->GetAtt(tablewidth), $ismake, $ctag->GetAtt(orderway) ) ); }
这一段,在其后添加如下代码:

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 ) ); } //end
最后找到function GetArcList这个方法,在其后添加一个可以通过传入sql参数获取指定数据源的方法,代码如下:

/** * 通过listsql标签中sql属性传入的参数来获得一个单列的文档列表 * */ 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}; $this->dsql->SetQuery($sql . $limitStr); $this->dsql->Execute('al'); $t2 = ExecTime(); //echo $t2-$t1; $sqllist = ''; $this->dtp2->LoadSource($innertext); $GLOBALS['autoindex'] = 0; //获取字段 while($row = $this->dsql->GetArray(al)) { $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; } //end
总共就添加三段代码,每一段代码基本都参考它紧接着的上面那段原始代码,而无需改变它原来任何一个地方的代码,应该算是比较完美的手术了,接下来在模板文件中的使用方法就跟一开始思路中所提到的那样,分页标签依旧沿用原来的,调用范例:

{dede:listsql sql='select ID,post_title from wp_posts' pagesize='10'}

Tags:语句   调用   在内

很赞哦! ()

上一篇:网站平台构建

下一篇:返回列表

文章评论

    共有条评论来说两句吧...

    用户名:

    验证码:

本站推荐