A controller function must either return a string or a dictionary. If a
string is returned, it is returned as the response body directly to the
client. If a dictionary is returned, web2py will call the associated view
and the keys in the dictionary will be available as variables in the view.
By default, web2py will look for a view with the same name as the function
inside a folder with the same name as the controller -- otherwise, it will
use generic.[extension] (depends on the specific extension of the request).
If you controller is 'mycontroller' and your function is 'myfunction', then
your view must be /views/mycontroller/myfunction.html. You can specify a
different name/location for the view, but you have to tell web2py by doing:
response.view='foldername/viewname.ext'
Check out:
http://web2py.com/book/default/chapter/03
http://web2py.com/book/default/chapter/04#Dispatching
Anthony
On Saturday, July 30, 2011 6:43:29 PM UTC-4, TD CtrlSoft wrote:
> controller:
> ....
> ....
> rows =
> db(query).select(db.table.id,db.table.field,orderby=~db.table.published,limitby=((page-1)*items_per_page,
>
> page*items_per_page))
> pages = UL([A(str(p),
> _href=URL('default','acquisitions_ajax',args=[str(p)])) for p in
> range(1,total_pages+1)], _class='test', _id=0)
> return (rows,pages) # here is my problem
>
> #return(rows) -works ; return (pages) also works. but
> return(rows,pages) not
>
> view:
> {{=SELECT( _id='c', _name="c",
> _onChange="ajax('"+URL(r=request,f='acquisitions_ajax')+"', ['c'],
> 'target')", *[OPTION('selectoption',_value="200")] +
> [OPTION(category.category_title, _value=category .id) for category in
> categories])}}
>
> <div id="target"></div>
>
> so, fi if i use return dict(rows=rows,pages=pages) it returns generic.html
> i think this is very easy, but i dont know how tot do this. can u help?
>
>
>