4 ms·
It can be abused, but I've seen controller heavy systems abused the same way. It depends on your goals. Some people prefer to write controllers, and the framewo
by ericingram 14y ago
It can be abused, but I've seen controller heavy systems abused the same way. It depends on your goals. Some people prefer to write controllers, and the framework also contains a controller pattern for those cases. For example, you could write this...
# controllers/BlogController.php
class BlogController extends AppController
{
function index ()
{
$this->entries = get("/channels/blogs/entries");
}
}
# templates/blog/index.html
{foreach $entries as $blog}
...
{/foreach}
Or, as in my example, this...
# templates/blog.html
{get $entries from "/channels/blogs/entries"}
{foreach $entries as $blog}
...
{/foreach}
I've written substantial apps both ways, and so far I have found that powerful templates are actually easier to write, read, and maintain, perhaps because the entire request flow happens in a single file.