if you define a function sidebar in your model

sidebar.py

def sidebar():
    return SPAN('teste') #this could return anything to be rendered in sidebar

You can call that in any view, even yout layout.html:

default/index.html
...
<hr />
<h1>README</h1>
{{=sidebar()}}
<ul>
...





2010/7/23 Rob <r...@rmdashr.com>:
> Hi,
>
> I would really like to take advantage of the left sidebar in the stock
> layout.html.  After reading http://web2py.com/book/default/section/5/4,
> it says that {{include}} must come before any function calls.  I only
> want to use the left_sidebar on a single page.
>
> How do I rewrite this so it works (notice left_sidebar())?
>
>          <div class="ez-fl ez-negmx">
>            <div class="ez-box" id="left_sidebar">{{left_sidebar()}}</
> div>
>          </div>
>          <div class="ez-fl ez-negmr">
>            <div class="ez-box" id="content">{{include}}</div>
>          </div>
>          <div class="ez-last ez-oh">
>            <div class="ez-box" id="right_sidebar">{{#------ unused
> space}}</div>
>          </div>
>
> I'd prefer not to have to go back and change all my views to be:
>
> {{def maincontent():}}
> < stuff >
> {{pass}}
>
> But if that's the only way, at least I know.
>
> Thanks!



-- 

http://rochacbruno.com.br

Reply via email to