Pass a list to your template

return render.index(pages.list())

then you can use the builtin function $len(pages) inside your template


2011/7/11 digistam <[email protected]>

> In my project I fill an index page with a database query, like this:
>
> .py page:
> pages = db.query("SELECT DISTINCT * from Table WHERE Column ='%s'" %
> (session.session_id))
>
> return render.index(pages)
>
> index.html:
> $def with (pages)
> $for page in pages:
>  $page.Column
> etc.
>
> Now, I would like to have a value on the index.html page representing
> the amount of records that are retrieved from the database, like this:
>
> $def with (pages)
> <p>Total results: $value</p>
>
> How do I do this ?
>
> Mark
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>


-- 
Federico Frenguelli

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to