473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Backend pagination problem in joomla1.7

Hi,
I am new to joomla component development.Now i am creating a simple image gallery.I have created it sucessfully in joomla1.6. But a small pagination problem while using it in joomla 1.7.The backend pagination is not working. I am using the tutorial "http://blog.opensourcenetwork.eu/tutorials/guru/mvc-workflow-with-jpagination".i am including the code here.
In model :
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. defined('_JEXEC') or die( 'Restricted access' ); 
  3. jimport('joomla.application.component.model'); 
  4.  
  5. class ComponentnameModelModelname extends JModel 
  6.     var $_data = null;
  7.     var $_total = null;
  8.     var $_pagination = null;
  9.  
  10.     function __construct() 
  11.     {
  12.               parent::__construct(); 
  13.             $application = JFactory::getApplication() ; 
  14.  
  15.             $config = JFactory::getConfig() ; 
  16.  
  17.             $limitstart = JRequest::getInt( 'limitstart', 0 );
  18.               //  $limit = $application->getUserStateFromRequest( 'global.list.limit', 
  19.                    // 'limit', $config->getValue('config.list_limit'), 'int' );        
  20.             $limit = 1;
  21.             $this->setState('limitstart', $limitstart); 
  22.             $this->setState('limit', $limit); 
  23.  
  24.     }
  25.  
  26.     function _loadData() 
  27.     {
  28.            if (empty($this->_data) && empty($this->_total)) 
  29.         { 
  30.  
  31.             $album = JRequest::getVar( 'album'); 
  32.  
  33.                $query = "SELECT * FROM #__databasename WHERE albumname='".$album."'";
  34.             $this->_db->setQuery($query); 
  35.  
  36.             $this->_data = $this->_db->loadObjectList(); 
  37.             $this->_total = count( $this->_data ) ; 
  38.  
  39.         } 
  40.  
  41.         return $this->_data ; 
  42.  
  43.     }
  44.  
  45.     function getData() 
  46.     {
  47.         $this->_loadData() ; 
  48.     $album = JRequest::getVar( 'album'); 
  49.  
  50.         $limitstart = $this->getState('limitstart');
  51.         $limit = $this->getState('limit');
  52.  
  53.        return array_slice( $this->_data, $limitstart,  $limit); 
  54.     }
  55.  
  56.     function getTotal() 
  57.     {
  58.        return $this->_total; 
  59.  
  60.     }
  61.  
  62.     function getPagination() 
  63.     {
  64.             $this->_loadData() ;
  65.  
  66.         if (empty($this->_pagination)) 
  67.         { 
  68.             jimport('joomla.html.pagination'); 
  69.  
  70.                 $limitstart = $this->getState('limitstart');
  71.             $limit = $this->getState('limit');
  72.                $total = $this->getTotal();
  73.  
  74.             $this->_pagination = new JPagination( $total, $limitstart,$limit); 
  75.         } 
  76.  
  77.         return $this->_pagination; 
  78.  
  79.      } 
  80. }
  81. ?>
  82.  
In views/photos/tmpl/default.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. defined('_JEXEC') or die( 'Restricted access' );
  3. $host = JURI::root();
  4. jimport('joomla.html.pagination');
  5. ?>
  6. <form name="adminForm" method="post">
  7.     <div class = "photo">
  8.         <img src="<?php echo $host?>images/<?php echo $item->image;?>" height = "300" width = "300" alt = "no image" />
  9.          </div>
  10.     <div id="photopagination">
  11.         <?php  echo $this->pagination->getPageslinks();?>
  12.     </div>
  13.     <div style="display:none">
  14.         <?php  echo $this->pagination->getListFooter(); ?>
  15.     </div>
  16. </form>    
  17.  
I am using a form named admin form in template file.When i add the getListFooter function only,pagination is working in backend.Is ant modification needs to be done in joomla 1.7 for working this???
Jul 30 '11 #1
1 2638
Try replacing
<form name="adminForm" method="post">
with
<form name="adminForm" method="post" id='adminForm'>
in your views/photos/tmpl/default.php file..
Hope it works for you!!
Nov 24 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Sharif T. Karim | last post by:
Anyone know of a up-to-date tutorial for pagination where I can have it like: Prev 1 2 3 4 Next Thanks. -- Sharif T. Karim ....you don't know wrath yet...
1
by: Faree | last post by:
I am workign on a news portal which needs paginaiton as usual.but all the code i got depends on the number of records that will come from database :( .it is working well too. But i need...
2
by: Chris H | last post by:
I am having a problem with pagination, basically the problem is happening in the "PREV / NUMBERS / NEXT" links, it appears as if the reason is becasue the increment and decrement operators aren't...
11
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. ...
1
by: Ted | last post by:
In MS SQL I used the following to create a stored procedure. USE AdventureWorks; GO IF OBJECT_ID ( 'HumanResources.usp_My_Search', 'P' ) IS NOT NULL DROP PROCEDURE HumanResources.usp_My_Search;...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
16
by: gnawz | last post by:
I have a pagination function I am using in a file called functions.php as below<? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET) && (int)$_GET > 0) ...
4
by: ArizonaJohn | last post by:
Hello, The code below works great. The user enters a name into an HTML form, the code looks up a table with that name, and then that table is displayed. I am trying to use pagination with it,...
2
by: kkshansid | last post by:
this is my search page on which i am getting two parameters from previous page but the problem is that as soon as i click any other next pages my sql query fails as it doesnt get these two parameters...
1
by: rienh | last post by:
I'am using Adam's pagination script from: http://www.developphp.com/view_lesson.php?v=289 And I adjusted the code just a little, so it fitted my needs. Now I bumb into a problem, and I can't figure...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.