Re: Extending HTML_Template_IT not working anymore

From: Date: Fri, 09 Apr 2010 17:51:45 +0000
Subject: Re: Extending HTML_Template_IT not working anymore
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30449@lists.php.net to get a copy of this message
Martín Marqués wrote:
I have a bunch of classes that extend HTML_Template_IT which were working great until latest upgrade on my development server to PHP 5.3 and HTML_Template_IT 1.3.0. The problem is that blocks don't get parsed, and I think it has to do with how my contructor is written: class HTML_UNL EXTENDS HTML_Template_IT { function __construct($html_dir="",$template_file=""){
    // Llamamos al contructor del padre, por si las moscas
    $this->HTML_Template_IT($html_dir);
    if($template_file!==""){
      // Cargo la plantilla
      $this->loadTemplatefile($template_file,true,true);
    }
} } Is this the right way to extend this class? Worked great until the latest upgrades came.
Martín, I believe you are using incorrect syntax for calling a parents constructor. The constructor code should look something like this (with php 5.3): function __construct($html_dir="",$template_file=""){
    parent::__construct($html_dir);
    if ($template_file!=="") {
        $this->loadTemplatefile($template_file,true,true);
    }
} Please try that and let us know how you go. Cheers, Gregory Currie

« previous php.pear.general (#30449) next »