how can I rotate articles on a page

6 posts by 2 authors in: Forums > CMS Builder
Last Post: February 15, 2008   (RSS)

Hello all Chris again so far we are doing really well with CMS

The owners of the site are in love with the idea of the articles rotating in and out with the most recent ones top 3 to be exact. http://www.raptorsuif.com/ was given to me as an example. I don't really need the buttons being highlighted just for the 3 most resent news articles being displayed on the front page.

Thanks
Chris

Re: [ChrisTitchenal] how can I rotate articles on a page

By Dave - February 14, 2008

Hi Chris,

So you don't want random, right? You want top 3? If you want, you can create a "featured" checkbox and only have featured articles on the frontpage, but the simplest way to do it otherwise is just create a list viewer with these options:

$options['perPage'] = '3'; // show only 3 records
$options['pageNum'] = '1'; // show only first page of results
$options['orderBy'] = 'date DESC'; // show newest records first
$options['where'] = '1'; // show all records


If you wanted only featured records you would have 'featured = 1' for the 'where'. Then finally don't bother copying and pasting the prev/next paging code since you don't want to page through, you just want the top 3.

Is that what you wanted? Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] how can I rotate articles on a page

Thanks Dave I have done that already. What they want is like the one article to be up on the home page for 10 seconds then the next one replaces it going over and over with the 3 most current ones. They are not a fan of the check box because many people will be working on the site writing articles so they want it to pull from all of the news category regardless. I can work it side ways if this was adding articles to an RSS like article Manager does I made something like this before but had to use a java script to display an RSS feed.

Thanks for your help

Chris

Re: [Dave] how can I rotate articles on a page

Thanks so much Dave I will start to work on that now. So because I want just 3 articles I limit my list view to 3, are they by defult sorted by date or will I need to define a sort order by date.



Chris

Re: [ChrisTitchenal] how can I rotate articles on a page

By Dave - February 15, 2008

Yes, you always need to define a sort order. Otherwise it will return them sorted by num or whatever order they happen to be in the database.
Dave Edis - Senior Developer
interactivetools.com