Featured Story?

8 posts by 2 authors in: Forums > CMS Builder
Last Post: February 9, 2010   (RSS)

Dear Interactive Tools,
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

This is not exactly what I needed done. I need when featured is checked for this story to appear in a completely different position on the page away from the other news stories all by itself.

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

No problem - just add a few more steps to what I said earlier.

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?

Yes that worked thank you!

Re: [sagentic] Featured Story?

I actually have an update to this. The person would like to hide this from the news stories if it is marked as featured. So in its current form it will display in 2 spots if it is marked as the featured story. Anyway to go about this?

Re: [sagentic] Featured Story?

Perfect thanks!