I wasn't thinking in terms of Ajax calls to stitch together these components/templates, but rather the {{include...}} mechanism to do this. I do agree that the current layout is modular, but then if I want re-use a piece of functionality present in that layout.html in some other page or in my own custom template, then I have to resort to cut-and-paste of the code. The intention is to keep this cut-and-paste to a minimum, or none at all. The other thing to consider is what should be the granularity of these templates, and if the "configuration" that brings these templates together can be defined in a single place.

A sample of what am thinking (needs to be refined further): https://github.com/kirsn/web2py_layout_template/blob/master/views/layout.html

________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On 11/12/2013 10:39 AM, Anthony wrote:
On Monday, November 11, 2013 11:28:37 PM UTC-5, Kiran Subbaraman wrote:

    My view is:
    Splitting / refactoring the contents of the layout.html into
    'components' - which contains a combination of css + html as
    mentioned in the original note:
    https://groups.google.com/forum/#!topic/web2py/3NmrocjbwzM
    <https://groups.google.com/forum/#%21topic/web2py/3NmrocjbwzM>


Are you saying you'd like something like this to be offered as an optional alternative or to replace the current layout.html? I don't think we want to have separate Ajax requests for every little piece of the layout.

Note, the current layout is already fairly modular, with separate blocks for the head, center, sidebars, and footer. It also allows you to conditionally include the left and right sidebars, Auth navbar, menu, logo, flash message, page title, and subtitle (by setting various attributes and global variables in the model, controller, and extending view code).

Maybe it would help if you provide some examples of what you are trying to achieve so we can figure out the best approach. If you want to re-use pieces of the layout in alternative layouts, perhaps we could put each piece in a separate template file and then just use {{include ...}} statements to insert them where needed. This would probably be much more efficient than running multiple Ajax requests to get what could just as easily be generated in a single request.

Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to