In my application the header and footer are rendered once, the content of 
the home page
loads using this variable in the controller:

page=LOAD('tier2', 'home_page', args=nodeID, ajax=True, target='content')

And in layout.html I have:

<div id="content" class="container">
  {{if page:}}
    {{=page}}
  {{pass}}
</div> <!-- /.container -->


The content of the other pages loads using web2py_component, 
web2py_component is triggered by an onclick event in the menu items:

<li {{if _active:}} class="active" {{pass}}>
  <a onclick="web2py_component('{{=_link}}', 
'content')">{{=_name.replace('_', ' ').capitalize()}}</a>
</li>

The .load views all more or less follow the same pattern:

home_page.load:

{{include 'tierblocks/jumbotron/txt.html'}}
{{include 'tierblocks/home_page.html'}}
{{include 'tierblocks/infocols/col_md_4.html'}}

event_list.load

{{include 'tierblocks/jumbotron/txt.html'}}
{{include 'calendar/event_list.html'}}
{{include 'tierblocks/infocols/col_md_4.html'}}

etc. which makes me wonder whether I could have just 1 .load view e.g 
page.load
with the following content.

{{include 'tierblocks/jumbotron/txt.html'}}
{{if request.controller ==  'tier2' and request.function == 'home_page':}}
    {{include 'tierblocks/home_page.html'}}
{{elif request.controller ==  'calendar' and request.function == 
'event_list':}}
    {{include 'calendar/event_list.html'}}
{{elif request.controller ==  'calendar' and request.function == 
'timetable':}}
    {{include 'calendar/timetable.html'}}
....
{{pass}}
{{include 'tierblocks/infocols/col_md_4.html'}}

What's the best way to organize the views?


Kind regards,

Annet

-- 
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