I am trying to give the option to users to select number of images showing per page using dropdown menu.
I modified the function writePagination(). Here my code:
Code: Select all
function writePagination() {
// Paggination Support
$html = "";
$number_per_page = $_REQUEST['npp'];
$page = $_REQUEST['page'];
if (isset($number_per_page)) {
$limit = $number_per_page;
}else{
$limit = $this->paginImgTotal; // How many items to show per page by default if visitor hasn't used dropdown.
}
$html= "
<form action='' method=POST >
<input type=hidden name=page value=\"$page\">
Items Per Page: <select name=\"npp\">
<option selected>$limit</option>
<option value=10>10</option>
<option value=25>25</option>
<option value=50>50</option>
</select>
<input type=submit value=\"Go\">
</form>
";
if ($this->params['paginUse']) {
if ($this->params['paginUse']) {
if (!empty($limit) && ceil($limit/ $this->params['paginImagesPerGallery']) > 1) {
$html.= '<div class="AG_pagin_wrap">';
$paginPrev = ($this->paginInitPages[$this->index] - 1);
if ($paginPrev >= 1) {
$html.= '<a href="" onClick="AG_form_submit_' . $this->articleID . '(' . $this->index . ',' . $paginPrev . ',\'' . $this->imagesFolderName . '\'); return false;" class="AG_pagin_prev">' . JText::_("PREV") . '</a>';
}
for ($i = 1; $i <= ceil($limit/ $this->params['paginImagesPerGallery']); $i++) {
if ($i == $this->paginInitPages[$this->index]) {
$html.= '<span class="AG_pagin_current">' . $i . '</span>';
} else {
$html.= '<a href="" onClick="AG_form_submit_' . $this->articleID . '(' . $this->index . ',' . $i . ',\'' . $this->imagesFolderName . '\',this);return false;" class="AG_pagin_link">' . $i . '</a>';
}
}
$paginNext = ($this->paginInitPages[$this->index] + 1);
if ($paginNext <= ceil($limit/ $this->params['paginImagesPerGallery'])) {
$html.= '<a href="" onClick="AG_form_submit_' . $this->articleID . '(' . $this->index . ',' . $paginNext . ',\'' . $this->imagesFolderName . '\'); return false;" class="AG_pagin_next">' . JText::_("NEXT") . '</a>';
}
$html.= '<br style="clear:both"></div>';
}
}
}
return $html;
}
Thanks in advance!
