Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

class-mysqldb i class-htmldbtree pod PHP 5, da li rade?

[es] :: PHP :: class-mysqldb i class-htmldbtree pod PHP 5, da li rade?

[ Pregleda: 2045 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

djukabog
Zrenjanin

Član broj: 10413
Poruke: 5
194.99.236.*

Sajt: www.djukabog.com


Profil

icon class-mysqldb i class-htmldbtree pod PHP 5, da li rade?22.01.2008. u 13:27 - pre 197 meseci
Ljudi, da li zna neko da li rade class-mysqldb i class-htmldbtree pod PHP 5?

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
*/

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;

}


Somebody help please,

Djuka

Edit: dodati code tagovi

[Ovu poruku je menjao dakipro dana 22.01.2008. u 19:34 GMT+1]
 
Odgovor na temu

b0ris
Boris Vujicic
Senior PHP programer
Beograd

Član broj: 126587
Poruke: 158
213.244.236.*



+2 Profil

icon Re: class-mysqldb i class-htmldbtree pod PHP 5, da li rade?22.01.2008. u 17:20 - pre 197 meseci
mogao bi da probas prvo da izvuces $_GET parametre i da ih dodelis obicnim promenljivama.
Nekad kad koristis isto ime promenljive i isto ime za $_GET parametar dobijas gresku u parsovanju koda, jos nisam shvatio zasto se to desava ali desava se.
I daj uredi malo taj kod totalno je ne citljiv, kakvo je to ime promenljive $aT ko ce to da razume???
Takodje losa je praksa da objekte definises kao globalne varijable.
Definisi funkciju koja ti pravi globalnu istancu tog objekta. Zatim pozivaj tu funkciju i vracaj referencu na vec postojeci objekat.
Proveri da li ti je $T uopste objekat.
---------------------------------------------------------------------
Just do it.
 
Odgovor na temu

djukabog
Zrenjanin

Član broj: 10413
Poruke: 5
194.99.236.*

Sajt: www.djukabog.com


Profil

icon Re: class-mysqldb i class-htmldbtree pod PHP 5, da li rade?25.01.2008. u 14:07 - pre 197 meseci
Na zalost nisam ja pisao te class-e, mozes ih download-ovati sa:

http://www.phpclasses.org/browse/file/8415.html
http://www.phpclasses.org/browse/file/8418.html

Inace to su class-e koje koristi Smarty CMS i koje u kombinaciji sa PHP 5.x.x ne rade. Normalno rade pod PHP 4.x.x, ali ih izgleda lik koji je pisao nije skoro update-ovao i optimizovao za PHP 5, bar mi se tako cini....

Djuka

 
Odgovor na temu

[es] :: PHP :: class-mysqldb i class-htmldbtree pod PHP 5, da li rade?

[ Pregleda: 2045 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.