View all link
2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 8, 2010 (RSS)
By dccreatives - June 8, 2010
I have a page that shows 12 items per page. I want the user to be able to click on a link that says 'View All' to see more on a page.
How is this accomplished?
How is this accomplished?
Re: [dccreatives] View all link
By Jason - June 8, 2010
Hi,
What you want to be able to do is to change the perPage option in the getRecords function.
For example, you probably have something that looks like this:
First, you need to set up your View All link like this:
Next, you can change you getRecords code like this:
This way, if they click on the link, all of the records will be displayed on one page, otherwise, it will default to displaying the first 12.
Hope this helps.
What you want to be able to do is to change the perPage option in the getRecords function.
For example, you probably have something that looks like this:
// load records
list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'perPage' => '12',
));
First, you need to set up your View All link like this:
<a href="YOURPAGE.php?view=all"> View All </a>
Next, you can change you getRecords code like this:
if(@$_REQUEST['view']=="all"){
$view="";
}
else{
$view=12;
}
// load records
list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'perPage' => mysql_escape($view),
));
This way, if they click on the link, all of the records will be displayed on one page, otherwise, it will default to displaying the first 12.
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/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/