Front End Pagination Problem
-
- Joomla! Apprentice
- Posts: 20
- Joined: Mon Oct 19, 2009 10:25 am
Re: Front End Pagination Problem
Hi guys,
Today, I'm very happy to found the solution to one of my old problem !! Thanks a lot.
I have updated my code, it works well except when I change the number of row to display !!
When I don't change it, I have an URL like this :
http://127.0.0.1/myproject/index.php/co ... &start=125
When I change the number of row to display, it becomes :
http://127.0.0.1/myproject/index.php/co ... ?start=100
Any idea why the URL changes ?
What should I do to solve the problem or what extra information do you need to better understand my problem ?
Thanks a lot
Thierry
Today, I'm very happy to found the solution to one of my old problem !! Thanks a lot.
I have updated my code, it works well except when I change the number of row to display !!
When I don't change it, I have an URL like this :
http://127.0.0.1/myproject/index.php/co ... &start=125
When I change the number of row to display, it becomes :
http://127.0.0.1/myproject/index.php/co ... ?start=100
Any idea why the URL changes ?
What should I do to solve the problem or what extra information do you need to better understand my problem ?
Thanks a lot
Thierry
-
- Joomla! Apprentice
- Posts: 47
- Joined: Fri Aug 08, 2008 7:33 am
Re: Front End Pagination Problem
First, thanks to this thread, finally I got the pagination working, but....
I dont get the limit working in the FE. In the backend everything works fine. I use the same model in BE and FE, so I didnt expected any problems using it in the FE.
My problem is that my js says: "this.form is null Line 1", when I try to use selector which chooses the number of items to display.
I tried to add different js files via $document->addScript(JURI::base().'includes/js/joomla.javascript.js');
But I dont get it. Help would be very nice.
Thanks
I dont get the limit working in the FE. In the backend everything works fine. I use the same model in BE and FE, so I didnt expected any problems using it in the FE.
My problem is that my js says: "this.form is null Line 1", when I try to use selector which chooses the number of items to display.
I tried to add different js files via $document->addScript(JURI::base().'includes/js/joomla.javascript.js');
But I dont get it. Help would be very nice.
Thanks
-
- Joomla! Apprentice
- Posts: 18
- Joined: Sun Feb 01, 2009 9:10 pm
Re: Front End Pagination Problem
If you used the code I posted, then your form may have a different name and that's why its not working, can you post all the code you are using in reference to this issue?Milbo wrote:First, thanks to this thread, finally I got the pagination working, but....
I dont get the limit working in the FE. In the backend everything works fine. I use the same model in BE and FE, so I didnt expected any problems using it in the FE.
My problem is that my js says: "this.form is null Line 1", when I try to use selector which chooses the number of items to display.
Thanks
-
- Joomla! Apprentice
- Posts: 47
- Joined: Fri Aug 08, 2008 7:33 am
Re: Front End Pagination Problem
I just used billengle tipp to get the switching of the pages to work:
I use this lines both in BE and FE:
I avoid to use your tip, because the component must work without changing corefiles. Or is it possible to extend the class?
Thanks for helping
Code: Select all
//$limitstart = $mainframe->getUserStateFromRequest(JRequest::getVar('option').'.limitstart', 'limitstart', 0, 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
Code: Select all
<?php echo $this->pagination->getListFooter(); ?>
Thanks for helping
-
- Joomla! Apprentice
- Posts: 18
- Joined: Sun Feb 01, 2009 9:10 pm
Re: Front End Pagination Problem
I used my way because i wanted it to work. good luckMilbo wrote:
I avoid to use your tip, because the component must work without changing corefiles. Or is it possible to extend the class?
Thanks for helping
-
- Joomla! Apprentice
- Posts: 47
- Joined: Fri Aug 08, 2008 7:33 am
Re: Front End Pagination Problem
you maybe did not understand me. I mean your tip changing the core files of joomla, I didnt meant your tips in general. It is usefull to get a page working, with some component/module or plugin for a special site, but is not useable for a bigger component, which is already used by thousands of people.
And as I asked. Maybe it is possible to extend this class, even when there is no abstract tag in the class definition.
On the other hand, I wonder how the other 3rd party developers solve this problem, when it is part of the joomla core files?
And as I asked. Maybe it is possible to extend this class, even when there is no abstract tag in the class definition.
On the other hand, I wonder how the other 3rd party developers solve this problem, when it is part of the joomla core files?
-
- Joomla! Apprentice
- Posts: 18
- Joined: Sun Feb 01, 2009 9:10 pm
Re: Front End Pagination Problem
they write their ownMilbo wrote:On the other hand, I wonder how the other 3rd party developers solve this problem, when it is part of the joomla core files?
-
- Joomla! Apprentice
- Posts: 47
- Joined: Fri Aug 08, 2008 7:33 am
Re: Front End Pagination Problem
poor solution by joomla then. There were several security patches since you posted your fix. Hmm annoying.
-
- Joomla! Apprentice
- Posts: 7
- Joined: Wed Jun 16, 2010 4:23 pm
Re: Front End Pagination Problem
This is a great fix to a very frustrating problem. To make sure the links behave as intended I suggest adding href="#" (to ensure you get a mouse pointer and for css), return false to the onclick call (to ensure the page doesn't jump to the top when the link is clicked) and class=\"pagenav\" (to make sure css is applied).
This line:
This line:
Becomes this:naturalcrusader wrote:Code: Select all
return "\n<a title=\"".$item->text."\" onclick=\"javascript: document.adminForm.limitstart.value=".$item->base."; document.adminForm.submit(); \" >".$item->text."</a>";
Code: Select all
return "\n<a title=\"".$item->text."\" href=\"#\" onclick=\"javascript: document.adminForm.limitstart.value=".$item->base."; document.adminForm.submit();return false; \" class=\"pagenav\">".$item->text."</a>";
-
- Joomla! Apprentice
- Posts: 47
- Joined: Fri Aug 08, 2008 7:33 am
Re: Front End Pagination Problem
Interesting, here is my solution that worked finally
So now it looks like that in the model:
I use this lines in FE view.html.php:
and in the layout:
No changing of core files are needed, pagination works fine now.
So now it looks like that in the model:
Code: Select all
$this->setState('limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $config->getValue('config.list_limit'), 'int'));
$this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));
// In case limit has been changed, adjust limitstart accordingly
$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
I use this lines in FE view.html.php:
Code: Select all
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
Code: Select all
<form name="adminForm" method="post">
<?php echo $this->pagination->getListFooter(); ?>
</form>
-
- Joomla! Apprentice
- Posts: 18
- Joined: Sun Feb 01, 2009 9:10 pm
Re: Front End Pagination Problem
nice, great work!Milbo wrote:Interesting, here is my solution that worked finally
So now it looks like that in the model:Code: Select all
$this->setState('limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $config->getValue('config.list_limit'), 'int')); $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int')); // In case limit has been changed, adjust limitstart accordingly $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
I use this lines in FE view.html.php:and in the layout:Code: Select all
$pagination = $model->getPagination(); $this->assignRef('pagination', $pagination);
No changing of core files are needed, pagination works fine now.Code: Select all
<form name="adminForm" method="post"> <?php echo $this->pagination->getListFooter(); ?> </form>
-
- Joomla! Apprentice
- Posts: 20
- Joined: Mon Oct 19, 2009 10:25 am
Re: Front End Pagination Problem
I've just updated my model. It works fine except when i change the number of row to display in the listbox. It works randomly...sometimes, the new page has only a few lines, without the buttons to go to next pages (Even if there are other rows to display...) when I go back with the Firefox button, then it is correctly displayed ...)
Sometime, nothing is displayed...
It seems something is missing to be perfect !
Nobody has an idea about that ?
Thanks
Thierry
Sometime, nothing is displayed...
It seems something is missing to be perfect !
Nobody has an idea about that ?
Thanks
Thierry
-
- Joomla! Apprentice
- Posts: 47
- Joined: Fri Aug 08, 2008 7:33 am
Re: Front End Pagination Problem
Strange, for me it works, even with changing numbers, maybe you missed the second line (// In case limit has been changed, adjust limitstart accordingly ).
Of course it is a bit strange to set it twice. I am not quite sure if it is optimized, but at least it works for me. :-)
Of course it is a bit strange to set it twice. I am not quite sure if it is optimized, but at least it works for me. :-)
-
- Joomla! Apprentice
- Posts: 20
- Joined: Mon Oct 19, 2009 10:25 am
Re: Front End Pagination Problem
I have the 2nd line...and it doesn't work...Sometimes I have error message like this :
In my Default :
In view.html :
If someone can help me, I will be very pleased...
thanks
Thierry
In my model I have :Trying to get property of non-object in C:\Program Files (x86)\EasyPHP5.3.0\www\totosicocm\components\com_content\views\frontpage\view.html.php on line 123
Code: Select all
function __construct()
{
parent::__construct();
global $mainframe, $option;
$this->setState('limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'));
$this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));
// In case limit has been changed, adjust limitstart accordingly
$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
}
/**
* Method to get item data
*/
function getData()
{
if (empty($this->_data))
{
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
}
return $this->_data;
}
/**
* Method to get the total number of items
*
*/
function getTotal()
{
if (empty($this->_total))
{
$query = $this->_buildQuery();
$this->_total = $this->_getListCount($query);
}
return $this->_total;
}
/**
* Method to get a pagination object
*/
function getPagination()
{
if (empty($this->_pagination))
{
jimport('joomla.html.pagination');
$this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}
Code: Select all
<tfoot class="paginate">
<tr>
<td colspan="8" >
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
Code: Select all
$items =& $this->get('data');
$total = & $this->get( 'Total');
$pagination = & $this->get( 'Pagination' );
thanks
Thierry
-
- Joomla! Apprentice
- Posts: 39
- Joined: Wed Dec 14, 2011 3:59 pm
Re: Front End Pagination Problem
I have this problem with the component JomSocial User List. What it does is categorizing JomSocial users by some criteria like profile type and profile fields, etc.
So, when one clicks on the userlist - a list of users appears according to some criteria... fine and very cool. When one goes to 2nd, 3rd page, etc. and one wants to go back to the start of category, clicking "beginning" or "1st page" does not work. It returns to 2nd page with start=5
example url when you click beginning or 1st page:
joomlafolder/userlistname?start=5
Anyone care to help to make it work with start=0 or remove the whole start variable idea for the 1st page? I am out of ideas.
So, when one clicks on the userlist - a list of users appears according to some criteria... fine and very cool. When one goes to 2nd, 3rd page, etc. and one wants to go back to the start of category, clicking "beginning" or "1st page" does not work. It returns to 2nd page with start=5
example url when you click beginning or 1st page:
joomlafolder/userlistname?start=5
Anyone care to help to make it work with start=0 or remove the whole start variable idea for the 1st page? I am out of ideas.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sun Apr 08, 2012 10:28 am
Re: Front End Pagination Problem
Hi there, this may be help you http://www.mangluoiweb.com/2012/03/comb ... r-and.html.