After some tries I got to this, which works fine:
My question is if the controller "saves" the "items" dict, or it queries 
for it on every time the view calls it (when moving between pages using the 
next/previous links?

Thanks.

controller
def index():
    items = db(db.t_items).select()
    return dict(items=items)

view:

{{if request.args(0):}}
{{item=items[int(request.args(0))-1]}}
<div class="view_item">
{{if int(request.args(0)) > 1 :}}
<a href="{{=URL('default', 'index', args=int(request.args(0))-1)}}"><< 
Previous item</a>
{{pass}}

{{if int(request.args(0)) < len(items) :}}
<a href="{{=URL('default', 'index', args=int(request.args(0))+1)}}">Next 
item >></a>
{{pass}}

<h1>{{=item.f_item_name}}</h1>
<div> <img width="200px" src="{{=URL(r=request, f='download', 
args=item.f_item_image)}}" /></div>
<div>{{=item.f_item_description}}</div>
<div>{{=item.f_item_price}}</div>
</div>
{{else:}}
{{for item in items:}}
<ul class="grid">
<h3><a href="{{=URL('default', 'index', 
args=item.id)}}">{{=item.f_item_name}}</a></h3>
<li>{{=item.f_item_description}}</li>
<li>{{=item.f_item_price}}</li>
<li><img width="200px" src="{{=URL(r=request, f='download', 
args=item.f_item_image)}}" /></li>
</ul>
{{pass}}
{{pass}}

On Sunday, September 1, 2013 8:56:16 PM UTC+3, אבי אברמוביץ wrote:
>
> Great, thanks.
>
> On Sunday, September 1, 2013 9:40:25 AM UTC+3, אבי אברמוביץ wrote:
>>
>> Hi,
>> I understand the url structure: app/function/view
>> but assuming I have a list of items on the view, How do I get to a view 
>> page for each one of them and where can I build that page template? 
>> Thanks.
>>
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to