![]() |
What do you think about PHPTAL?
Hi folks,
I'm curios if you know PHPTAL and what you think about it. IMHO it's the best templating system available for PHP. No PHP code or proprietary tags in the template files, just valid XML/XHTML. But what's your opinion? Best regards, Alex |
It kicks ass. Also has integrated internationalization, besides forcing you to write valid XHTML and it's way faster than Smarty.
|
Looks interesting, thanks
|
Quote:
|
I think a poll about what template engines people use could be interesting. But which PHP template engines except from Smarty and PHPTAL are worth to be mentioned?
|
I am considering implanting this on my site, but I do have one issue: In my opinion, a template system does not only separate backend from frontend, but it also makes sure I do not have to repeat i.e. my HTML header on every file. How may I do this in PHPTAL?
I used to include a header file on top of every page, but this does not work with PHPTAL. |
Hi Runar,
this is done via Macros. Lets say you have one file (macros.html) containing your header, footer, etc. containing this code: HTML Code:
<div metal:define-macro="header">HTML Code:
<div metal:use-macro="macros.html/header" />HTML Code:
<div metal:use-macro="macros.html/footer" />Way better is to use slots: Lets say you have one template for all your pages (template.html): HTML Code:
<html metal:define-macro="page_template">HTML Code:
<tal:block metal:use-macro="template.html/page_template">PHP Code:
You should also read the manual for PHPTAL on PHPTAL :: Template Attribute Language for PHP Greetings, Alex |
Ah, great! I was looking for something like that in the manual, but tried to understand the basics first. Now it works perfectly!
I will try to solve my last issue myself, but in case you already know the solution: I want to display an extra </tr><tr> if the number of people repeated (with tal:repeat) is 4. Any suggestions? Edit: I followed your example, but had to replace metal:fill-slot="content" with metal:define-slot="content" in template.html. |
Does anyone have a tutorial how to integrate this into zend framework??
|
You should consider to use an 3d array like
PHP Code:
HTML Code:
<table>Alex |
Eat this: Zend_View_PhpTal - Matthew Ratzloff - Zend Framework Wiki :-D
I don't know if it works with current releases of ZF, but i've used that successfully with ZF 1.5 Greetings Alex |
Btw you can use PHPTAL for templating any XML-Output like RSS/Atom feeds or XSL-FO where XSLT transformation is oversized.
Greetings Alex |
awuehr, you seem quite knowledged with PHPTAL. You're not considering to make a tutorial? :-)
|
Good idea. I really should do this, but I am not very good explaining technical things in english.
Is there a possibility to preview an article? |
I'm sure you'll do absolutely great :-)
No it doesn't look like you can =/ |
PHPTAL was surprisingly easy to understand. The manual explains everything quite well, but I would not say no to a tutorial. It is always better to understand when and how to use the different functions, not only how they work and what they do.
|
First part (basics) of a short tutorial is waiting to be approved... :)
Greetings, Alex |
Awesome :-D I'll check it as soon as it goes public :-)
|
But the first one is VERY basic...
|
Yea well, I haven't really done anything in PHPTAL, so that's just good that it's basic :-)
|
| All times are GMT. The time now is 11:56 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0