In my component, I am using Joomla default pagination calling $this->pagination->getPagesLinks()
in the view template file.
Say, my component url is like this at a certain point: http://localhost/joomla/index.php/menu-item-name?cid=79&tid=3
and when a page link is clicked, I want that url to omit the component related parameters (cid=79&tid=3
). So when going to the desired page, that url becomes http://localhost/joomla/index.php/menu-item-name?start=2
.
So how do I achieve this? What pagination class functions can I override? I could not find a way because if I override getPagesLinks()
in the JPagination class, it would not work because pagination links are generated from template's overridden files too.
Please help me in both Joomla 2.5 and 3
Edit:
Ok, I implemented router.php
. In it's build()
function...
$segments[] = $query['cid'];
$segments[] = $query['tid'];
if (isset($query['start'])) {
$segments[] = $query['start'];
unset($query['start']);
}
unset($query['cid']);
unset($query['tid']);
unset($query['view']);
and in the parse()
function...
$vars['view'] = 'category';
$vars['cid'] = $segments[0];
$vars['tid'] = $segments[1];
$vars['start'] = $segments[2];
return $vars;
So when I load my component without any variables in the url, the next page link in pagination becomes http://localhost/joomla3.3/menu-item-name/2
, even when component has some variables in the url then the url look like http://localhost/joomla3.3/menu-item-name/4/79/2
. Both of these urls' last 2 is the pagination's page value (like start=2
), but when I click a page link, it's not going to next page but staying and loading some items in same page.
So how do I make the pagination links work with router because I don't simply want ?start=2
to be added to the end of the url.