Home > CMS Tutorial > DEDECMS > body text

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

藏色散人
Release: 2019-12-18 10:02:55
Original
2113 people have browsed it

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|';
Copy after login

Modify to

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

2. Add

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

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");
Copy after login

to

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

to here All modifications are completed. The usage method

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template