Re[2]: [PHPTAL] best practise ?

2009-08-28 Thread GRolf


I tried that too - however, the inserted html is escaped so the  are
htmlentities



Vriendelijke groeten,
Tom De Bruyne

--
More Fast BVBA - Management Tool Development
E-mail: i...@morefast.be
Tel: 0477 77 53 52



Thursday, August 27, 2009, 10:42:30 PM, you wrote:

 Hi,

 I've never been a big fan of metal macros so I might be a bit biased here.

 What I would do is instead of creating a slot for the header, populate
 it in your general.tpl file directly.
 Since you're already including a file in your pages to calculate the 
 header contents, you could put there the tal instructions to fill up the
 header directly in the general template.

 /imv

 On 8/27/09 8:36 PM, GRolf wrote:


 I'm building a website and I'm wondering about the best approach ...

 The goal is the following: there is a general design of every page
 (header, main, footer). The content of the header changes based on the
 visitors adminlevel (nearly every visitor has something else in the
 header) - the exact content of this header is retrieved and parsed in
 PHP.

 The other parts of the page (eg 'main'), depend on the PHP page and
 can be handled by using a different file in setTemplate().


 What I currently do:

 * I have a 'general.tpl' file, which contains
 html tal:define-macro=generalstructure
 body
 div id=headertal:block tal:define-slot=header//div
 div id=maintal:block tal:define-slot=main//div
 div id=footertal:block tal:define-slot=footer//div
 /body
 /html

 * every PHP file (index.php, register.php etc) calls it's own script
 file (index.tpl, register.tpl etc) via $phptal-setTemplate(). Each
 file contains something like

 tal:block metal:use-macro=general.tpl/generalstructure
 tal:block metal:fill-slot=main

I'm index.php ...

 /tal:block
 /tal:block


 * every page (index.php etc) also contains included code to retrieve
 the header content (retrieve_header($user_id));


 How can I now best ensure that this header content is nicely parsed
 into the header-slot, without having to put metal:fill-slot code in
 each and every page template ?


 Could somebody please give me an idea of PHPTal is supposed to handle
 this kind of situations? If you have any other suggestions how to
 improve this setup, be my guest ...







 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal



 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: Re[2]: [PHPTAL] best practise ?

2009-08-28 Thread Kornel Lesiński

On 28-08-2009 at 08:40:54 GRolf ger...@pictureparking.com wrote:


I tried that too - however, the inserted html is escaped so the  are
htmlentities


structure keyword prevents that:

${structure 'div'}


How can I now best ensure that this header content is nicely parsed
into the header-slot, without having to put metal:fill-slot code in
each and every page template ?


That's one way to do it:

$phptal-setTemplate(page.xhtml);
$phptal-page_body = $phptal-execute();

$phptal-setTemplate(general.xhtml);
echo $phptal-execute();

and in general.xhtml have ${structure page_body}.


Another is to add tal:block metal:use-macro=… using prefilter.

--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal