OK, the original suggestion was to use Ajax components, but using 
{{include}}'s certainly makes sense. I'm not sure how much of this we want 
to do in the scaffolding app, though. It makes the code a bit more complex 
to follow, and for non-compiled views, it will slow down the template 
processing as well. The scaffolding app is intended to be a basic starting 
point. If you have a special use case that requires multiple layouts that 
are different enough that they can't be generated from a single layout.html 
but that nevertheless need common components that themselves don't change 
from layout to layout, it's easy enough to break up the standard layout 
yourself in a way that exactly meets your needs (the example you linked 
would only take a few minutes to create).

Separating out at least some of the <head> section as well as the scripts 
section at the bottom of the layout might be particularly useful because 
those sections are not tied to the styling of the scaffolding app and 
should therefore be more portable to other layouts (in fact, part of the 
head section is already modularized into web2py_ajax.html).

Anthony

On Tuesday, November 12, 2013 1:20:00 AM UTC-5, Kiran Subbaraman wrote:
>
>  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 Subbaramanhttp://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 
>>  
>
>  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 web2py+un...@googlegroups.com <javascript:>.
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to