From: =?UTF-8?B?TWFydMOtbiBNYXJxdcOpcw==?= on
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 Marqués
select 'martin.marques' || '@' || 'gmail.com'
DBA, Programador, Administrador
From: Gregory Currie on
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

From: =?UTF-8?B?TWFydMOtbiBNYXJxdcOpcw==?= on
2010/4/9 Gregory Currie <gregory.currie(a)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
From: Ward Morris on
Martin, you're probably going to have to dig in deeper and provide us with
better debugging information to help you. Is anything output? What do the
class variables look like before parsing? Are you getting any errors?

I'm really not familiar with HTML_Template_IT, but I don't see a parseJS()
function in the documentation. Not sure what class contains that function
in your application or what it's doing.

2010/4/13 Martín Marqués <martin.marques(a)gmail.com>

> 2010/4/9 Gregory Currie <gregory.currie(a)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
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Ward Morris

morris.ward(a)gmail.com
mobile: (573) 434-1056
From: =?UTF-8?B?TWFydMOtbiBNYXJxdcOpcw==?= on
El día 13 de abril de 2010 11:38, Ward Morris <morris.ward(a)gmail.com> escribió:
> Martin, you're probably going to have to dig in deeper and provide us with
> better debugging information to help you.  Is anything output?  What do the
> class variables look like before parsing?  Are you getting any errors?

No errors.

> I'm really not familiar with HTML_Template_IT, but I don't see a parseJS()
> function in the documentation.  Not sure what class contains that function
> in your application or what it's doing.

parseJS is a method from the class HTML_UNL defined like:

public function parseJS(){
for($i=0; $i < count($this->jsFiles); $i++){
$this->setCurrentBlock("jsfile");
$this->setVariable("JSFILE",$this->jsFiles[$i]);
$this->parseCurrentBlock();
}
}

jsFiles is an array with the name of the JS files, and the jsfile
block has a script object in the header that loads the JS file. Same
thing happens with parseCSS().

I found out that changing the order of parent::__construct() with the
other methods in the constructor made somethings work: particularly
setVariable() calls from outside my Class.

Very strange behavior.

>
> 2010/4/13 Martín Marqués <martin.marques(a)gmail.com>
>>
>> 2010/4/9 Gregory Currie <gregory.currie(a)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
>>
>> --
>> PEAR General Mailing List (http://pear.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
> --
> Ward Morris
>
> morris.ward(a)gmail.com
> mobile: (573) 434-1056
>



--
Martín Marqués
select 'martin.marques' || '@' || 'gmail.com'
DBA, Programador, Administrador