Keep an article at top of page

9 posts by 5 authors in: Forums > CMS Builder
Last Post: February 12, 2008   (RSS)

By grauchut - January 10, 2008

Is there a way to add a check box to keep a certain news incident at the top of a page.
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Keep an article at top of page

By Djulia - January 10, 2008 - edited: January 10, 2008

Re: [grauchut] Keep an article at top of page

By Dave - January 10, 2008

And for a checkbox, it's pretty much the same. Just add a checkbox field called 'featured', then add "featured DESC" to sort in descending order (so featured articles are first) to the beginning of the "List Order" field (under Section Editors) and to $options['orderBy'] in your "list viewer".

Let me know if you need more details.

One last note, because checkboxes save as "0" or "1", records you had before adding the field might sort differently (because you're sorting "1", "0", and "" (blank). If you already have a lot of records, you can either click "modify", "save" on each one to set the featured value to "0" or instead of "featured DESC" use "IF(featured,0,1)".

Sorry if I made that more complicated than it needed to be. :) Let me know if you need any clarification.
Dave Edis - Senior Developer
interactivetools.com

Re: [Theo] Keep an article at top of page

By Dave - January 10, 2008

Posted at 10:43... Always just one minute ahead of me aren't you Theo? :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Keep an article at top of page

By Theo - January 10, 2008

You're slowing down now that you've hit 30, old man! Hah hah!

(...hope no one remembers that I'm 34...)
Theo Wiersma

Re: [Theo] Keep an article at top of page

By grauchut - January 10, 2008

Once again thanks for the help. Your company is truly great when it comes to support. Thanks Again Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [Theo] Keep an article at top of page

By NigelGordijk - February 12, 2008

Hi, Theo.

Please can you tell me where your line of code should go if I want to list headlines in reverse order, so that the newest ones are always at the top? I currently have this on my list page:

<!-- STEP2: Display Record List (Paste this where you want your records to be listed) -->
<?php foreach ($listRows as $record): ?>
<P><STRONG><A HREF="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></A></STRONG><BR/>
<I>Added <?php echo date("l j F Y", strtotime($record['date'])) ?></I></P>
<P>
<?php endforeach ?>
<?php if (empty($listRows)): ?>
<!-- Display "No Records Found" Message -->
No records were found!<BR/>
<BR/>
<?php endif ?>
<BR/>
<!-- /STEP2: Display Record List -->

Regards, Nigel
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Keep an article at top of page

By Dave - February 12, 2008

Hi Nigel,

In your 'orderBy' option just add 'DESC' after title. DESC is a MySQL keyword which means descending or reverse order. So it might look something like this:

$options['orderBy'] = 'featured DESC, date DESC';

Hope that helps, let us know if you need anything else.
Dave Edis - Senior Developer
interactivetools.com