Featured Story?
8 posts by 2 authors in: Forums > CMS Builder
Last Post: February 9, 2010 (RSS)
I have a client who posts news stories. They would like to have a checkbox within the CMS that makes the story there featured story which will then put it in its own Featured Story area above the other news stories. It cant be its own section because they want it to archive with all the old news stories so I did not know if there was something I could add to the code that would make a single story appear if it were checked.
Thank you for your help!
Re: [InfamousNugz] Featured Story?
By Kenny - October 20, 2009
Create a checkbox field called "Featured" then change the orderBy to featured.
This means all of the "featured" articles will be first. If you have a date field you sort by featured, date DESC - this will make the featured stories come up first then the latest story by the latest date.
Make sense? Let us know if you need more help with this.
Kenny
Re: [sagentic] Featured Story?
By InfamousNugz - October 21, 2009 - edited: October 21, 2009
I would like a local news story once checked off in the CMS to go to the featured news section. I assume I would need to duplicate the information with some kind of addition to the checkbox field. I also use an older version that has a bug with checkboxes that only allows me to use 1 and 2 to validate my fields.
Re: [InfamousNugz] Featured Story?
By Kenny - October 21, 2009 - edited: October 21, 2009
On your (news) list page you need to insert the foreach statements twice - one for each section of news articles.
The first one (featured articles) needs to have an if statement added to it like this:
<?php foreach ($newsRecords as $record): ?>
<?php if ($record['featured']): ?>
//Insert other code here
<?php endif ?>
<?php endforeach; ?>
Does that help?
Kenny
Re: [sagentic] Featured Story?
Re: [InfamousNugz] Featured Story?
By Kenny - February 9, 2010
<?php foreach ($newsRecords as $record): ?>
<?php if (!$record['featured']): ?>
//Insert other code here
<?php endif ?>
<?php endforeach; ?>
The exclamation mark = not
So what the statement is saying is if it is "not" featured, then display the record.
Let me know if that doesn't work.
Kenny