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?
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!