Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8164495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:19:47+00:00 2026-06-06T19:19:47+00:00

So I’ve been following this tutorial on JPagination and on the section about with

  • 0

So I’ve been following this tutorial on JPagination and on the section about with JDatabase it has a variable $option on line 2 "$option.limit". (It hasn’t been referenced anywhere else on the page, I’m unsure on where this value is being declared/initialized).

$db =& JFactory::getDBO();
$lim    = $mainframe->getUserStateFromRequest("$option.limit", 'limit', 14, 'int'); //I guess getUserStateFromRequest is for session or different reasons
$lim0   = JRequest::getVar('limitstart', 0, '', 'int');
$db->setQuery('SELECT SQL_CALC_FOUND_ROWS x, y, z FROM jos_content WHERE x',$lim0, $lim);
$rL=&$db->loadAssocList();
if (empty($rL)) {$jAp->enqueueMessage($db->getErrorMsg(),'error'); return;} 
else {
////Here the beauty starts
$db->setQuery('SELECT FOUND_ROWS();');  //no reloading the query! Just asking for total without limit
jimport('joomla.html.pagination');
$pageNav = new JPagination( $db->loadResult(), $lim0, $lim );
foreach($rL as $r) {
//your display code here
}
echo $pageNav->getListFooter(  ); //Displays a nice footer

I’ve had a look around joomla docs on pages such as this to see if the $option variable is relevant to the limitBox, because the limitbox displaybox is what is setting the amount things to be displayed. But I haven’t had much luck.

Therefore I’m wondering how are you meant to obtain the information from the variable $option and/or the current selection from the LimitBox in JPagination.

Pastebin link to my implementation [expires in 24 hours]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:19:48+00:00Added an answer on June 6, 2026 at 7:19 pm

    The article is out of date in a few ways, it was originally written for J1.5 and assumes a lot of knowledge about the inner workings. I wouldn’t recommend it for J2.5.

    Pagination is mostly automatic today if you’re following the J2.5 MVC and using it’s built-in (for the most) part user state mechanism. To start with, in J2.5 your model should should be extending JModelList if you’re displaying a list of content items. JModelList extends JModel by adding useful features for dealing with lists.

    One of these features is the populateState() method, in it’s base state it will look after your list limits for you if you’re using a <select> named limit. It does this by managing the base userState for you, I would recommend reading through /administrator/com_contact and /libraries/joomla/application/component/modellist.php (Joomla API JModelList).

    populateState() is used to help the model keep track of basics for your component in a semi-automatic way. In addition to list limits, it will also track the search field and the sort column & it’s direction. If you extension needs to track other user states or override settings you can create a populateState() in your model file – just remember to call the parent before hand so you still get the built-in benefits. e.g.

    protected function populateState()
    {
        parent::populateState();
        $app = JFactory::getApplication('site');
    
        /* Do some groovy stuff here
         * like adding our own form variables to the state to use later
         */
        $srid = $this->getUserStateFromRequest($this->context.'.project.srid','srid');
        $this->setState('project.srid', $srid);
    
    }
    

    For user state you can read more in this article (which also covers Pagination briefly) “How to use user state variables”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.