are you using view in the MVC sense or the Django sense?

In the MVC sense:

views do not see functions defined in controllers unless they are
passed explicitly.
views see functions defined in model files
you can define functions in views if you need. Inside {{ }}

You should avoid calling response.write and use {{= }} when possible.

Examples

def table_of_size(n):
     return TABLE(*[TR(*[TD(i*j) for i in range(n)]) for j in range
(n)])

{{=table_of_size(10)}}


On Dec 7, 9:29 am, Tari <[EMAIL PROTECTED]> wrote:
> Hello, I'm still learning web2py, and have hit a wall once more:
>
> I'd like to know if it is possible to call a function from a view, one
> that would e.g. output a number of LI() helpers in a loop, and also
> append a text string to the HTML.
>
> I tried calling "response.write" from within a controller function,
> and  it outputs what it should, but it renders the content before all
> else - plus it's not called from a view, in fact, it outputs
> regardless of being called or not.
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to