What is a good template system for PHP?

What is the best / easiest way to integrate into the template system for PHP, and what are the benefits of using it?

Currently, I do not use it at all, and I think that this can help separate content from the presentation a little more.

+5
source share
9 answers

Smarty


I found it fast, easy to use, and easy to install (even in a shared hosting environment). It also does not require you to use XHTML validation, which is sometimes convenient (although I think that the template engines that do require valid XHTML are probably faster.)

It's very nice to have your content in one place and code somewhere else.

, HTML. Smarty XML SQL.

+12

PHP - . PHP langauge .

, (- resemebling) MVC - .

Smarty, , PHP, , . , - , . , , , PHP.

+14

, , PHP MVC.

- , PHP.

+3

PHPTAL.

XML . , XSS, .

Smarty raw PHP , , echo $foo ${foo} ( |escape} htmlspecialchars()) HTML- , , .

PHPTAL , HTML/XML, . , - :

<strong tal:omit-tag="condition">
  xxx
</strong>

:

{if condition}<strong>{/if}
  xxx
{if condition-again!}</strong>{/if}

XML ( ). HTML - .

+3

Mark, Smarty . () MVC Smarty, . .

+1

, , xss.

+1

: . Smarty , , , , PHP. , , , .

, Savant3, Zend_View Zend Framework PHP . , , -. , PHP , .

0

PHP/HTML . HTML, (, DreamWeaver), , PHP, HTML .

0
source

I used Smarty for many years, but was disappointed because the special smarty syntax was in the way when some simple php would be easier. PHP itself is the main template language! I found out that php api is suitable enough for all presentation logic.

Savant3 and its descendant Zend_View are therefore excellent solutions. As with Smarty, you can easily write plugins for repetitive tasks.

0
source

All Articles