Pagination and number of images showing per picture (option)

Admiror Gallery is free extension for Joomla! 1.6. Joomla! 1.7 and Joomla! 2.5 based websites. Admiror Gallery is all in one, a simple and instant solution for rendering image gallery from folder with images, but very flexible and adaptable.
Post Reply
Message
Author
pantrif
Posts: 1
Joined: Wed Nov 06, 2013 8:04 pm

Pagination and number of images showing per picture (option)

#1 Post by pantrif »

Hi and thanks for this great component,

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;
    }

But no luck so far!

Thanks in advance!

Admiror Gallery 5 - Fundraising Campaign

User avatar
Vasiljevski
Developer
Developer
Posts: 1258
Joined: Sat Aug 14, 2010 9:31 pm
Location: Novi Sad, Serbia
Contact:

Re: Pagination and number of images showing per picture (opt

#2 Post by Vasiljevski »

Well that part is OK, but writePagination() is only responsible for displaying page buttons (Prev,1,2,3) under the gallery.
So changing this function is OK, but real modification are needed in loadImageFiles. Here the template actually provides images to the template.

If I find the time I will give you some more info, maybe some code example how to develop what you need.

But I would recommend you to try to make a new template and try to develop all the functionality inside the template.
Help Admiror Gallery become even better,
give us a review on JED

Post Reply