Dear all,

this is my first post as well as my first attempt with web2py. I've read 
through most of the book and have the following question.

Here are a few guidelines I've understood:


   - Each controller/function should have it's own view
   - There are two ways to build up a webpage one is programmatically and 
   one is by modifying the view.

For example I could have a view:


# controller.py


def fun1():

    return { 'content' : H1('Hello') + P('this is my first app World') }


def fun2():

    return { 'content' : H1('Hello Again') + P('this is the second page') }


and 


views/controller/fun1.html


{{extend layout.html}}

{{=content}}


views/controller/fun2.html


{{extend layout.html}}

{{=content}}


The alternative would be:


# controller.py


def fun1():

    return { }


def fun2():

    return { }


and views:


views/controller/fun1.html


{{extend layout.html}}

<h1>'Hello'</h1>

<p>'this is my first app World'</p>


views/controller/fun2.html


{{extend layout.html}}

<h1>'Hello Again'</h1>

<p>'this is the second page'</p>


What is the difference, which is better practice? In this simple case which 
pattern is it advisable I follow?


Thank you

-- 
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/d/optout.

Reply via email to