Home  >  Article  >  CMS Tutorial  >  How does DreamWeaver make the channelartlist tag support the limit attribute?

How does DreamWeaver make the channelartlist tag support the limit attribute?

藏色散人
藏色散人Original
2019-12-18 10:02:552070browse

How does DreamWeaver make the channelartlist tag support the limit attribute?

How does Dreamweaver make the channelartlist tag support the limit attribute?

Open the file: includetaglibchannelartlist.lib.php

Recommended learning: 梦Weavercms

1. Will

$attlist= 'typeid|0,row|20,cacheid|';

Modify to

$attlist= 'typeid|0,row|20,cacheid|,limit|';

2. Add

$limit= trim(preg_replace('#limit#is', '', $limit));   
if($limit!='') $limitsql= " LIMIT $limit ";   
else$limitsql= " LIMIT 0,$totalnum";

3 in front of "$dsql->SetQuery". Change

$dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,
siteurl,sitepath FROM `zmb_arctype` WHERE $tpsqlORDER BY sortrank ASC LIMIT $totalnum");

to

$dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,
moresite,siteurl,sitepath FROM zmb_arctype WHERE $tpsql ORDER BY sortrank ASC $limitsql");

to here All modifications are completed. The usage method

{dede:channelartlist limit='0,1'}{/dede:channelartlist}

limit: (starting ID starts from 0) indicates a limited record range (for example: limit='1,2' means starting from the record with ID 1, taking 2 records

The above is the detailed content of How does DreamWeaver make the channelartlist tag support the limit attribute?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn