Archived news stories

10 posts by 2 authors in: Forums > CMS Builder
Last Post: March 16, 2011   (RSS)

I have archived news stories but in different archives, so for example 2010, 2009, 2008. I have next and previous links on the news detail pages to take you to the next or previous news story. This gets a bit mixed up though when you go to news detail page in an archive because the next or previous link takes you to the next or previous story in the list and not in the archive. Can anyone help.

Re: [Jason] Archived news stories

I'm not sure how this would work, the archives are split into school terms.

Re: [MercerDesign] Archived news stories

By Jason - March 11, 2011

Hi,

Could you provide a URL to an example demonstrating the issue?

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Archived news stories

Here is the URL of the news archive page:

http://www.ardingly.com/Nursery_Preprep_Schools_Sussex/Pre_Prep_News_Dates/News_term_archives.php

If you click on one of the archives and then through to one of the stories you will see what I mean.

Thanks.

Re: [MercerDesign] Archived news stories

By Jason - March 14, 2011

Hi,

Okay, I think I see what's happening. So your archived records are actually stored in different sections. Is that right?

If so, the best thing to do would be to have a separate archive detail page where you pull the record from your archive section, not your news section.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Archived news stories

The way it works is there is a list page for each archive, that pulls in the stories from the relevant list in the news section, there isn't an actual archive section in the CMS. Sorry I'm getting confused.

Re: [MercerDesign] Archived news stories

By Jason - March 15, 2011

Hi,

If you could attach the .php files you're working with, I could take a look to see if I can make any suggestions. This may start to get more complicated than what we can handle in the forum. If it does, we may have to look to moving this to our consulting service.

For now, lets take a look at the code and see what's happening there.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Archived news stories

I have attached the main news archive page, the archive page for 2 terms, then the detail page. Thank you for your help.

Re: [MercerDesign] Archived news stories

By Jason - March 16, 2011

Hi,

What's happening is that getPrevAndNextRecords() function doesn't allow for a where clause, so it's returning the next/previous record relative to the entire list, not in the archive section you want.

What you'll need to do is to create a news detail page specifically for viewing archive records. You can then use a loop to figure out which records come before and after the selected record like this:

NOTE: This code has not been tested against actual records.

list($news_pre_prepRecord, $news_pre_prepMetaData) = getRecords(array(
'tableName' => 'news_pre_prep',
'where' => " news_pre_prep_archive = 'summer10' "
));

$prevRecord = array();
$nextRecord = array();

$recordNumber = getNumberFromEndOfUrl();

for($index = 0; $index < $news_pre_prepMetaData['totalRecords']; $index++ ) {

if($news_pre_prepRecord[$index]['num'] == $recordNumber ) {

if($index != 0){
$prevRecord = $news_pre_prepRecord[$index - 1];
}

if($index != ($news_pre_prepMetaData['totalRecords'] -1 )) {

$nextRecord = $news_pre_prepRecords[$index + 1];
}
}
}


Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/