Include "selected" news item instead of by date

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 1, 2011   (RSS)

By ScottL - January 31, 2011

I'm currently including the two newest 'news' items on the main page with this:

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'allowSearch' => true,
'orderBy' => "createdDate DESC",
'limit' => 2,

How can I allow the site owner to select which two items to include instead of doing it by the two newest dates?

The reason for this is they may want to go back and display an older story instead of the two newest.

Thanks

Re: [thinkng] Include "selected" news item instead of by date

By Jason - January 31, 2011

Hi,

What you can do is have a check box in your news section called something like "news_selected". You can then change your query like this:

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'allowSearch' => true,
'where' => "news_selected = 1",
'limit' => 2,
));


Note that if the user selects more than 2, it will still only return the first 2.

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/