I'm a bit confused.

When I look at the link created by pagination in the front end, I see a query parameter called start included in the individual page number links and Start and End links.

However, the method populateState in the base JModelList class looks for limitstart if $this->context has a non null value.

Since the base constructor for JModelList sets $this->context to be equal to <component_name>.<model_name> it looks like in the default case $this->context will not be null, so populateState will usually assign the value from $_GET['limitstart'] using getUserStateFromRequest() as the snipped code shows:

$value = $app->getUserStateFromRequest($this->context . '.limitstart', 'limitstart', 0);
$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
$this->setState('list.start', $limitstart); 

I would be really grateful if someone could explain why things are done this way, and what I have to do to get populateState and pagination to agree on the variable that holds the row that the page should start on.


  • If you using default pagination by calling $pagination = $this->get('Pagination'); in view file then required state vars in model's populateState method are easy to understand in this way - $limit= $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint'); $this->setState('list.limit', $limit); $limitstart = JRequest::getUInt('limitstart', 0); $this->setState('list.start', $limitstart); – dev-m May 15 '14 at 21:17
  • so as i replied this is what you will basically do by overriding populateState() method in your model class extended from jmodellist, else you would be messed up with parent class codes. – dev-m May 16 '14 at 21:48
  • Thanks @professional for providing the solution. I think the change between start and limitstart has something to do with SEF but I haven't figured out where the switch is yet. Could you post you reply as the answer and I'll accept it. – Nick Weavers May 18 '14 at 9:36

Some default codes are confusing as joomla uses those for processes start to end of page rendering. As per the requirements, pagination needs following two state variables set, so you need to set in your model's overridden populateState() method(source - com_weblinks) -

// List state information
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
$this->setState('list.limit', $limit);

$limitstart = JRequest::getUInt('limitstart', 0);
$this->setState('list.start', $limitstart);

furthermore, if you look getPagination() method in jmodellist parent class, you can get idea how things are calculated from state variables to display pagination.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.