14/11/2011 7:20am

PHP | Problem - Pagination 2 Problem


PHP>>>>>>>>>>>>>>>>

public function LightboxGalleryPagination($per_page=3) {

$images = $this->LightboxGalleryImages(null, 'SortOrder');

$start = (isset($_GET['start'])) ? (int)$_GET['start'] : 0;

$page = $images->getRange((int)$_GET['start'],$per_page);

var_dump($per_page);die;// This show the Value set in template
$page->setPageLimits($start,$per_page, $images->count());// inside here, it Does NOT use the value from template


return $page;

}
Template >>>>>>>>>>>>>>>
<% control LightboxGalleryPagination(6) %>
$Attachment.CroppedImage(100,100)
<% end_control %>


2 Comments 2 Solutions

14/11/2011 7:29am

PHP | Solution - Anonymous

public function LightboxGalleryPagination($perPage=false) {
static $per_page = 3;
if($perPage) $per_page = $perPage;
$images = $this->LightboxGalleryImages(null, 'SortOrder');

$start = (isset($_GET['start'])) ? (int)$_GET['start'] : 0;

$page = $images->getRange((int)$_GET['start'],$per_page);

$page->setPageLimits($start,$per_page, $images->count());// inside here, it Does NOT use the value from template


return $page;

}

14/11/2011 7:22am

PHP | Solution - Anonymous

 <% if LightboxGalleryPagination.MoreThanOnePage %>


<% if LightboxGalleryPagination.PrevLink %>
<< Prev |
<% end_if %>

<% control LightboxGalleryPagination.Pages %>
<% if CurrentBool %>
$PageNum
<% else %>
$PageNum
<% end_if %>
<% end_control %>

<% if LightboxGalleryPagination.NextLink %>
| Next >>
<% end_if %>


<% end_if %>

Post Comment