Unapred se izvinjavan na povecem postu koji sledi.
Naime, sajt koji je koristio ove class-e pod Smarty-jem je radio na PHP 4.3.8, ali kako je sajt prebacen na drugi server na kome je PHP 5.2.5 dobijam poruku o gresci:
"Fatal error: Call to a member function select_single_to_array() on a non-object in /usr/home/xxxx/public_html/_classes/class-htmldbtree.php on line 122"
Kod gde je linija 122:
function get_single_node($startnode) {
line 122:-> return $this->db->select_single_to_array($this->tablename,$this->fields,"WHERE ".$this->fields['id']." ='$startnode'");
}
samo header od class-htmldbtree da ne postavljam celu klasu:
/**
* Class for easy management of Mmodified Preordered Tree Traversal data represetation
* stored in database
* based on a tutorial about Modified Preordered Tree Traversal data model
* found at http://www.aesthetic-theory.com/learn.php?mptt
* @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>
* @copyleft (l) 2003-2004 Jonathan Gotti
* @package DB tree manipulation
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @changelog 2004-11-26 --
* 2005-02-25 - add forgotten support for sqlitedb
* - now remove can return the full removed tree structure
* 2005-02-28 - modify the remove method to use the new method optimize of both mysqldb and sqlitedb
* 2005-04-24 - correct some E_ALL errors (thanks to webstudio.lv)
* @TODO better error support
* @require class-mysqldb.php or class-sqlitedb
*/
/**
*Htmldbtree object for easy management of Mmodified Preordered Tree Traversal data represetation
*/
nasao sam i update ove class-e, kao i class-e class-mysqldb, ali mi i dalje ne radi pod PHP 5.
update headera od class-htmldbtree da ne postavljam celu klasu:
Code:
/**
* Class for easy management of Mmodified Preordered Tree Traversal data represetation
* stored in database
* based on a tutorial about Modified Preordered Tree Traversal data model
* found at http://www.aesthetic-theory.com/learn.php?mptt
* @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>
* @copyleft (l) 2003-2004 Jonathan Gotti
* @package DB tree manipulation
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @changelog - 2006-03-08 - HtmlDbTree::make_sibling() take now a third parameter $younger to put the node before instead of after the sibling node.
* - new methods: HtmlDbTree::next/prevbrother(), HtmlDbTree::moveup/down() as asked by Bruno Gaspar
* - 2006-03-07 - now HtmlDbTree::cookmenu() will skip node when the $dataMapping callback return FALSE
* - now HtmlDbTree::cookmenu() return the div element too.
* - 2006-03-06 - new method HtmlDbTree::cookmenu() for jscookmenu (by Heng Yuan) var generation (requested by Marco Valk <[email protected]>)
* (see http://www.cs.ucla.edu/~heng/JSCookMenu/index.html for more detail on jscookmenu)
* - HtmlDbTree::get_childs() now use the cached datas by default instead to query the database
* added third parameter $fromdb to retrieve datas from database
* - 2006-02-27 - remove some more error_notice
* - 2006-02-10 - bug correction in get_tree method when left_id and right_id are named in an other way.
* Thx to Azlan Muhamad Sufian for point it out <azlanms1 at tnb dot com dot my>
* - 2005-07-27 - add some SQL injection protection by setting some types or add some slashes
* - 2005-06-17 - bug correction in the get_path method
* - 2005-06-14 - get_path() method improvement commit by Lasse Lofquist <lass_phpclass at tvartom.com>
* - 2005-02-28 - modify the remove method to use the new method optimize of both mysqldb and sqlitedb
* - 2005-02-25 - add forgotten support for sqlitedb
* - now remove can return the full removed tree structure
* - 2004-11-26 --
* @require class-mysqldb.php or class-sqlitedb
*/
/**
* Class for easy management of Mmodified Preordered Tree Traversal data represetation
* stored in database
* based on a tutorial about Modified Preordered Tree Traversal data model
* found at http://www.aesthetic-theory.com/learn.php?mptt
* @author Jonathan Gotti <nathan at the-ring dot homelinux dot net>
* @copyleft (l) 2003-2004 Jonathan Gotti
* @package DB tree manipulation
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @changelog - 2006-03-08 - HtmlDbTree::make_sibling() take now a third parameter $younger to put the node before instead of after the sibling node.
* - new methods: HtmlDbTree::next/prevbrother(), HtmlDbTree::moveup/down() as asked by Bruno Gaspar
* - 2006-03-07 - now HtmlDbTree::cookmenu() will skip node when the $dataMapping callback return FALSE
* - now HtmlDbTree::cookmenu() return the div element too.
* - 2006-03-06 - new method HtmlDbTree::cookmenu() for jscookmenu (by Heng Yuan) var generation (requested by Marco Valk <[email protected]>)
* (see http://www.cs.ucla.edu/~heng/JSCookMenu/index.html for more detail on jscookmenu)
* - HtmlDbTree::get_childs() now use the cached datas by default instead to query the database
* added third parameter $fromdb to retrieve datas from database
* - 2006-02-27 - remove some more error_notice
* - 2006-02-10 - bug correction in get_tree method when left_id and right_id are named in an other way.
* Thx to Azlan Muhamad Sufian for point it out <azlanms1 at tnb dot com dot my>
* - 2005-07-27 - add some SQL injection protection by setting some types or add some slashes
* - 2005-06-17 - bug correction in the get_path method
* - 2005-06-14 - get_path() method improvement commit by Lasse Lofquist <lass_phpclass at tvartom.com>
* - 2005-02-28 - modify the remove method to use the new method optimize of both mysqldb and sqlitedb
* - 2005-02-25 - add forgotten support for sqlitedb
* - now remove can return the full removed tree structure
* - 2004-11-26 --
* @require class-mysqldb.php or class-sqlitedb
*/
A kada iskoristim nove class-e, class-mysqldb.php i class-htmldbtree.php fajlove, dobijam sledecu poruku:
"Fatal error: Call to undefined method HtmlDbTree::get_for_nav() in /usr/home/xxxx/public_html/index.php on line 190"
Ovo je funkcija gde se nalazi 190 linija:
Code:
function getMainMenu() {
global $T;
$return = '<ul id="mainnav">
<li><a href="/" class="nlevel3">Poèetna stranica</a></li>
';
// $T = &$GLOBALS['T'];
//$aP = $T->get_for_nav($GLOBALS['id']);
//$aMP = $T->get_path($GLOBALS['id']);
[blue]linija 190->[/blue] $aP = $T->get_for_nav($_GET['id']);
$aMP = $T->get_path($_GET['id']);
$aIDIP = array();
foreach ($aMP as $K=>$V) $aIDIP[$V["id"]] = true;
foreach ($aP as $i => $v) {
$A = (key_exists($aP[$i]['id'], $aIDIP) && $_GET['id']!=$aP[$i]['id'])?" thislink":"";
$A .= ($_GET['id']==$aP[$i]['id'])?" currentpage":"";
$return .= '<li><a href="trudnoca.php?id=' . $aP[$i]['id'] . '" class="nlevel'. $aP[$i]['level'] . $A . '">' . $aP[$i]['title'] . '</a></li>';
}
$return .= "</ul>";
return $return;
}
function getMainMenu() {
global $T;
$return = '<ul id="mainnav">
<li><a href="/" class="nlevel3">Poèetna stranica</a></li>
';
// $T = &$GLOBALS['T'];
//$aP = $T->get_for_nav($GLOBALS['id']);
//$aMP = $T->get_path($GLOBALS['id']);
[blue]linija 190->[/blue] $aP = $T->get_for_nav($_GET['id']);
$aMP = $T->get_path($_GET['id']);
$aIDIP = array();
foreach ($aMP as $K=>$V) $aIDIP[$V["id"]] = true;
foreach ($aP as $i => $v) {
$A = (key_exists($aP[$i]['id'], $aIDIP) && $_GET['id']!=$aP[$i]['id'])?" thislink":"";
$A .= ($_GET['id']==$aP[$i]['id'])?" currentpage":"";
$return .= '<li><a href="trudnoca.php?id=' . $aP[$i]['id'] . '" class="nlevel'. $aP[$i]['level'] . $A . '">' . $aP[$i]['title'] . '</a></li>';
}
$return .= "</ul>";
return $return;
}
Somebody help please,
Djuka
Edit: dodati code tagovi
[Ovu poruku je menjao dakipro dana 22.01.2008. u 19:34 GMT+1]