Limit the number of records displayed

4 posts by 3 authors in: Forums > CMS Builder
Last Post: June 6, 2012   (RSS)

I have a news list which shows all the current news, I have also told all my other pages to pull in the first record from that list which works fine, my problem is on the news page I want all the current news displayed in the main content area but I also still want only the first record pulled into an area on the right, so my question is how do I keep all the records showing but then limit the same list of records to just one on the page in the different area.

Re: [Mercer Design] Limit the number of records displayed

By Jason - June 1, 2012

Hi,

You could try something like this:

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
));

$firstNewsRecord = array();

if($newsRecords) {
$firstNewsRecord = $newsRecords[0];
}


In this example, $newsRecords is a list of all of your news articles. $firstNewsRecord is the first record from that list. These variables can be displayed separately.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Limit the number of records displayed

Sorry I cannot get this to work, I have it set up so that on the news page it pulls in the news which I have setup with a checkbox, because there are news articles for sport, art, etc and then the main news.

Here is a link to the page in question:
http://www.ardingly.com/testing_development/Ardingly_College_Sussex/News_Independent_Schools_Sussex/News_list.php

You will see that I want all the main news to appear in the middle but only the first one in the right hand area at the bottom. It works fine on this page:

http://www.ardingly.com/testing_development/index.php

Another thought is I have a featured article checkbox so that ticked article can appear in the main list of news and the featured area, but I'm not sure how to do that and to just show the featured article in the right hand area.