Go!
 
 
May 16, 2008, 05:26:09 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Category Pagination doesnt work fine in Administratormode  (Read 3932 times)
Alessandro
Newbie
*
Offline Offline

Posts: 21


View Profile
« on: October 18, 2006, 06:39:56 PM »

I noticed that if you have several Categories and dozens of subcategories, the pagination doesnt work anymore in administrator modus. The first page of categories always works, but all others wont. They dont show a single category, even if there are plenty of them.

in "administrator\components\com_easygallery\classes\categories.php" i found a small glitch. The Recursive Tree Generator wont work if you dont have the root of the tree. I mean, if you set a query limit, the result may start at a point <> root.

To fix this the easy way, i will get all records from database, build the tree and then slice the tree. that way it works fine.

And heres what i've done:

in: administrator\components\com_easygallery\classes\categories.php

search: 
Code:
$query = str_replace("%s", "*", $basequery) . ' LIMIT ' . $limitstart . ', ' . $limit;
  $database->setQuery($query);
  $rows = $database->loadObjectList();
  echo $database->getErrorMsg();

replace with:
Code:
$query = str_replace("%s", "*", $basequery); //  . ' LIMIT ' . $limitstart . ', ' . $limit;
  $database->setQuery($query);
  $rows = $database->loadObjectList();
  echo $database->getErrorMsg();


search ( attention! replace the first occurrence only!! In function show() ):
Code:
    //loop through all items
    for($i=0,$n=count($tree[0]);$i<$n;$i++){
      $row = $tree[0][$i];
      categories::recurseCategorie($tree, $final, $row, $level);
    }

replace with:
Code:
    //loop through all items
    for($i=0,$n=count($tree[0]);$i<$n;$i++){
      $row = $tree[0][$i];
      categories::recurseCategorie($tree, $final, $row, $level);
    }
    //cut tree to selected area
    $final = array_slice($final, $limitstart, $limit);

Greets!  Grin
« Last Edit: October 19, 2006, 11:30:03 AM by Alessandro » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Joomla-addons.org © 2006 | www.bandhosting.nl | JCD-A Member | Newsletter | Sitemap |