When a request comes in for /myapp/mycontroller/myfunction, it gets routed
to the myfunction() function in the mycontroller.py controller. In that
case, by default the view is set to /views/mycontroller/myfunction.html. If
web2py doesn't find that view, it will then use /views/generic.html, but
only if generic views have been enabled (for details see
http://web2py.com/books/default/chapter/29/10#Generic-views) -- otherwise
it will return an error.
However, you can also specify a different view before having the function
return:
def myfunction():
response.view = 'path/to/otherview.html' #note, this is relative to the
/views folder
[more code]
return dict(...)
So, instead of using generic.html, you can specify any custom view file,
and you can even set it dynamically within the function.
Anthony
On Monday, May 7, 2012 11:00:49 AM UTC-4, Hassan Alnatour wrote:
>
> Dear ALL,
>
> I want to create a Content management system that has the ability to
> create pages , now as i know when i want to create a page in web2py first
> i need the function and then i need the html page or else use the
> Generic.html for my pages , now any ideas of how to create pages using
> somthing like an admin side , now i want to use the template blocks so am
> thinking about editing the generic view and make it work with blocks but
> how can i create the function in the controller and , how dose web2py
> knows if that function has a page or not , how dose it decide to use
> generic view or the normal page ???
>
> Best Regards,
>
>