News for hackers. Stuff that matters.
Re:WordPress 3.5 “Elvin” Released by ericingram on Tuesday December 11, 2012 @04:03PM (#4906800)
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.

There are no comments on this comment yet.