Re: Re: Extending HTML_Template_IT not working anymore
| From: | Martín Marqués | Date: | Tue, 13 Apr 2010 14:06:58 +0000 |
| Subject: | Re: Re: Extending HTML_Template_IT not working anymore | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-30456@lists.php.net to get a copy of this message | ||
2010/4/9 Gregory Currie <gregory.currie@gmail.com>:
>
> 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.
OK, I changed some things. First I'll explain the extends of my clases:
HTML_UNL extends HTML_Template_IT
Cascara extends HTML_UNL
printLogin extends Cascara
Now this is what I have in each one of these Classes:
class HTML_UNL EXTENDS HTML_Template_IT {
function __construct($html_dir="",$template_file=""){
// Llamamos al contructor del padre, por si las moscas
parent::__construct($html_dir);
if($template_file!==""){
// Cargo la plantilla
$this->loadTemplatefile($template_file,true,true);
}
}
...
}
Class Cascara EXTENDS HTML_UNL {
function __construct($plantilla = false){
// Llamamos al contructor del padre, por si las moscas
parent::__construct("templates");
// Cargo la plantilla
if($plantilla === false)
$this->loadTemplatefile("cascara.html",true,true);
else
$this->loadTemplatefile($plantilla,true,true);
}
...
}
class printLogin extends Cascara {
function __construct(){
// Llamamos al contructor del padre, por si las moscas
// Cargamos la plantilla
parent::__construct("login.html");
// The methods below come from the parent
// Mandamos el mensaje de error si hace falta.
$this->fallo();
$this->addJSFile("js/verifform.js");
$this->addJSFile("js/setfocus.js");
$this->parseJS();
$this->setForm();
}
...
}
No luck. Variables outside of defined blocks don't get parsed with setVariable()
--
Martín Marqués
select 'martin.marques' || '@' || 'gmail.com'
DBA, Programador, Administrador