Suggestion for slight change to docs
Posted: 21 August 2007 04:42 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  194
Joined  01-20-2002

On this doc page for the query module, it says:

The pagination in the Query module works exactly like the Weblog and Comment Pagination with only one exception. In the Query module you cannot have a LIMIT clause on your query. Instead you have to use a limit=”“ parameter to specify how many results to display per page, and then ExpressionEngine will automatically modify your query to display the appropriate results.

After fiddling around with it myself, I find that the reverse is also true. Meaning, if you choose to use the limit=”“ parameter rather than using LIMIT within the actual query you MUST use pagination inside the query.

So, this works:

{exp:query limit="5" sql="SELECT title,entry_date FROM exp_weblog_titles ORDER BY entry_date DESC"}

<p>{title} - {entry_date format="%Y %m %d"}</p>

{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}

{
/exp:query}

And this works:

{exp:query sql="SELECT title,entry_date FROM exp_weblog_titles ORDER BY entry_date DESC LIMIT 5"}

<p>{title} - {entry_date format="%Y %m %d"}</p>

{/exp:query}


But this does not:

{exp:query limit="5" sql="SELECT title,entry_date FROM exp_weblog_titles ORDER BY entry_date DESC"}

<p>{title} - {entry_date format="%Y %m %d"}</p>

{/exp:query}

 Signature 

A Way with Words, public radio’s lively language call-in show: word origins, slang, grammar, usage, old sayings, and more.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65027 Total Logged-in Users: 43
Total Topics: 82117 Total Anonymous Users: 23
Total Replies: 441315 Total Guests: 206
Total Posts: 523432    
Members ( View Memberlist )