Question

just wondering if a PHP web framework or templating engine exists, that uses the clean view philosophy used in Lift, the Scala webframework.

In short the clean view philosophy, is that there should be zero code in the views. And that the view should be valid HTML.

I would like to replace a typical piece of PHP code like this:

<ul>
<?php foreach ($addressbook as $name):?>
    <li><?=$name?></li>
<?php endforeach; ?>
</ul>

With a html tag only template like this:

<ul>
    <framework:AddressBookView.listNames>
        <li:name />
    </framework:AddressBookView.listNames>
</ul>

Which would call the listNames method on the AddressBookView class. The listNames method would then take care of repeatedly binding the names from the AddressBook names to the <li:name /> tag.

Was it helpful?

Solution

PHPTAL is just such a template engine...

http://phptal.org/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top