News - Items how to display

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

By avrom - March 13, 2008 - edited: March 14, 2008

Hello Dave,

I know this is an easy one for you. Here is a page of news items:

http:/news.php

I created the page using the List Viewer. In the same table "news" is all the other detailed information such as the content etc. to display on the linked items:

i.e. <a href="<?php echo $record['_link'] ?>"><?php echo $record['news_item'] ?></a>

and

$options['viewerUrl'] = 'newsPage.php';

from the list viewer.

I don't know what the next step is to display the corresponding linked result newsPage.php?5 on the newsPage.php page.

Do I need to create a seperate newsPage.php or can it all be done on the news.php page as well ?

Thanks Dave,

Just a little lost..
Avrom

Re: [virgodesign] News - Items how to display

By avrom - March 13, 2008

Okay got it - LOL I have a brain :)

List Viewer for the News Listings...

Page Viewer for the actual articles...

Re: [virgodesign] News - Items how to display

By Dave - March 14, 2008

heh, glad you got it working. Nice clean design!

Double check the spelling on the header graphic "Executive".

Let me know if you have any other questions!
Dave Edis - Senior Developer
interactivetools.com

Re: [virgodesign] News - Items how to display

By Dave - March 14, 2008

>Actually if there is a way to have Prev and Next on the Page Viewer (the newsPage.php) that would be awesome.

That's a tricky one. I've been thinking about it for a while. I'm not sure what the simplest way would be. One way would be to have two list viewers on the page. One for the "previous article" and one for the "next article". Setting each one to return 1 record 'perPage' and to show 'page' 1. Then for the 'where' set the previous list viewer to be "date < $record['num']" or "date > $record['num']".

Basically you need a way to identify the current record and then get one record that's sorted ahead or behind it.

I think it could take a little while to work out, but we could probably get something working early next week if that worked for you. What field are you sorting on with your news viewer? date?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] News - Items how to display

By avrom - March 14, 2008

Its not essential by any means. Just something cool for the site, but way over my head :)

Yes I am sorting by the date.

Re: [virgodesign] News - Items how to display

By Dave - March 15, 2008

I can think of a way to do it by date, so long as all you don't sort by "featured" and all the dates are different. So it doesn't work well in all situations.

Another way to do it is with a list viewer and just show 3 records per page with the first one as a previous article link (to the list viewer) and the third record as a next article links. That's still a bit of a hack too because since you're using list "page numbers" to display the record you can't bookmark them (since what's on page 3 will change as you add new content).

I'll keep thinking about it and post if I can come up with something better.
Dave Edis - Senior Developer
interactivetools.com