Need Some Help

6 posts by 3 authors in: Forums > CMS Builder
Last Post: July 16, 2010   (RSS)

By (Deleted User) - July 14, 2010

I have a site that is using cmsbuilder that lists obituaries by date, the site currently lists all obits that are less than 1 year old. My client now wants to limit the current obits to a limited number (20) on the current page, they also would like to have link that shows the older obits that have been entered (21 to xxxx). If this is possible any help would be appreciated. thanks

Re: [jda] Need Some Help

By Jason - July 15, 2010

Hi,

Yes, this is possible and doesn't take much code to do. So, just to make sure I understand, you want to have your page to show the first 20 obits for that year, and then have a link to "show older", which takes them to a page which would show all of the obits for that year that are past the first 20?
Is that right?

Also, if you could attach the current .php page that you're working with, I can give you much more specific instructions on how to do this.

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] Need Some Help

By (Deleted User) - July 15, 2010

Yes that is correct I have attached the current page
Attachments:

newslist.php 7K

Re: [jda] Need Some Help

By Jason - July 15, 2010 - edited: July 16, 2010

Hi,

Okay. For the link to view older obituaries, you can use something like this:

<a href="newslist-1.php?older=1">View Older Obituaries</a>

Then we just need to change how we select the records up at the top of the page. Try this:

if(@$_REQUEST['older']){
list($obits1Records, $obits1MetaData) = getRecords(array(
'tableName' => 'obits1',
'offset' => 20,
));
}
else{

list($obits1Records, $obits1MetaData) = getRecords(array(
'tableName' => 'obits1',
'limit' => '20',
));
}


What this does is that if the user clicks on the link to view the older obits, the script selects all the records that come after the 20th record. If the link hasn't been clicked, it selects the first 20.

Give this a try and let me know if you run into any problems.

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: [affinitymc] Need Some Help

By Jason - July 16, 2010

Hi Brian,

Thanks for catching the "odler" mistake.

'offset' => 20
would work, since the offset can be evaluated as a number and not a string, but either would be fine.

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/