limit results
2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 27, 2011 (RSS)
By zaba - April 27, 2011
Hi I have a list of news stories, which I want to break down into 2 groups, the first being latest which will show the first 8 records, the second archive group will show the second 8 records. the limit code does not work in the same way as mysql limit function. how can i achieve this.
// load records list
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'limit' => '8',
'loadUploads' => '0',
'allowSearch' => '0',
));
// load records list archive
list($newsARecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'limit' => '8,8',
'loadUploads' => '0',
'allowSearch' => '0',
));
Re: [zaba] limit results
By Damon - April 27, 2011
Hi zaba,
You can use the 'offset' setting to achieve the results you are after. The "offset" option lets you skip a number of records. Since you want skip the first 8 records, the offset is set to 8 and and the limit is set to 8 to display the next 8 records.
Here is a also a link to the viewer documentation for reference:
http://www.interactivetools.com/docs/cmsbuilder/viewer_options.html
Give that a try and let me know if that works out!
You can use the 'offset' setting to achieve the results you are after. The "offset" option lets you skip a number of records. Since you want skip the first 8 records, the offset is set to 8 and and the limit is set to 8 to display the next 8 records.
// load records list
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'limit' => '8',
'loadUploads' => '0',
'allowSearch' => '0',
));
// load records list archive
list($newsARecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'offset' => '8',
'limit' => '8',
'loadUploads' => '0',
'allowSearch' => '0',
));
Here is a also a link to the viewer documentation for reference:
http://www.interactivetools.com/docs/cmsbuilder/viewer_options.html
Give that a try and let me know if that works out!
Cheers,
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/