Ok, I have a {{include}} statement in the beginning of the layout.html file 
that cals index.html and the corresponding index.py controller. And that one 
returns variables. So there is no way to call sidebar.py with tve corresponding 
view to get the variables?

22 dec 2012 kl. 20:53 skrev Anthony <abasta...@gmail.com>:

> When you include a view like:
> 
> {{include 'default/sidebar.html'}}
> 
> it is not calling a sidebar() function in the default.py controller. Rather, 
> it is simply including the code from the sidebar.html file at that point in 
> your main view file, as if the code had been manually inserted there. No 
> additional controller functions are called. For a single request, only one 
> controller function is called. When that function returns, its view is 
> rendered, and that view can be constructed by extending and including other 
> views -- but the other views do not call their own controller functions.
> 
> Anthony
> 
> On Saturday, December 22, 2012 3:11:38 PM UTC-5, jonas wrote:
>> 
>> this is probably simple but I post it anyway
>> 
>> I have a layout that includes sidebar.html:
>> 
>>     <section id="main" class="main row">
>>        <br>
>>        <br>
>>         <div class="span2 left-sidebar offset1">
>>        <!-- <div class="headerDivider"></div> -->
>>        {{block left_sidebar}}
>>        {{include 'default/sidebar.html'}}
>>        {{end}}
>>         </div>
>> 
>> and sidebar.html:
>> 
>> {{left_sidebar_enable=True}}
>> <h4><i class="icon-user"></i> me (from sidebar.html):</h4>
>> {{for pre in about:}}
>>   {{for pr in pre.presentation.split():}}
>>   <dl class="dl">
>>   <dd><i class="icon-check"></i> {{=pr}}</dd>
>>   </dl>
>>   {{pass}}
>>   <h5><i class="icon-arrow-right"></i> Contact: {{=pre.contact}}</h5>
>> {{pass}}
>> 
>> however, my controller returns variables but I cannot see them in the view. 
>> When checking, the controller is not even called: 
>> 
>> def sidebar():
>> 
>>     query=db.about.id>0
>>     ab=db(query).select()
>>     print 'called sidebar'
>>     return dict(ab=ab)
>> 
>> the view is in view/default and the controller is in controller/default.py
>> 
>> why is not the controller called?
> 
> -- 
>  
>  
>  

-- 



Reply via email to