Hi Kornel,

Kornel Lesinski schrieb:
> On 18 Mar 2008, at 22:32, Gosi wrote:
>> i think there is a bug in PHPTAL.php at the executeMacro() method.
>> the "require_once" at line 338 is missing.
>> else {
>>     // call local macro
>>     require_once $this->getCodePath();
>>     $fun = $this->getFunctionName() . '_' . trim($path);
>>     if (!function_exists($fun)) throw new PHPTAL_Exception(...);
>>     $fun( $this, $this->_context );
>> }
> It's not a bug, it's a feature ;)
> This code fragment is for macros defined in the same file as their
> caller, so there should be no need to load the file again.
> If it doesn't work for you, could you send me an example template that
> exposes the bug?

I need a way to just execute a macro or execute the hole template. So
I'm calling the public executeMacro method. This only works with the



if ($this->_renderMacro) {
        echo $this->_phptal->executeMacro($this->_macroName);
} else {
        echo $this->_phptal->execute();

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml";>
  <tal:block  metal:use-macro="table" />
  <table metal:define-macro="table">
                <td style="border: 1px dashed green">
                        <tal:block replace="var1" />
                <td style="border: 1px dashed red">
                        <tal:block replace="var2" />
                <td style="border: 1px dashed green">
                        <tal:block replace="var3" />

regards, gosi

PHPTAL mailing list

Reply via email to