Re: Naming Conventions for Views and Helpers in Recess PHP Framework

This post is a response to Joshua Paine’s blog entry Naming Conventions for Views and Helpers in Recess PHP Framework

1) CamelCase : Agree.

2) Capitalization of View Helpers : LoL @ Aladdin reference.  Agree.

3) Changing view to template :

I agree that the name view could lead to confusion.  I also agree that the word template is longish.  However, I think page would not make a good name for the class.  Using the word page implies a context, that the template being rendered is a part of a page.  It might be a partial being returned in an AJAH request without the body and html elements, or might not contain HTML at all.

One of the most used methods in the simple framework I whipped up is Template::render($tpl_name, $data).

It seems to me that all methods contained within the view page class are specific to the rendering of templates.

So… how about the class name tpl ?

tpl::start('foo/bar');
    tpl::block('head');
        <script src="foo.js"></script>
    tpl::blockEnd();
tpl::end();

 
Additionally, I get the feeling there may come the need for a layout view helper.  Not sure how it might fit in just yet.

4) Paired function names like block and endBlock : see above, recommend block(’params’), blockEnd() //no params

No Comment

No comments yet

Leave a reply