works wonderfully thank you. Newbie me I didn't get that db.select was 
returning a subset of the table in rows as opposed to a list of strings. 

On Friday, July 26, 2013 12:14:11 PM UTC-4, lesssugar wrote:
>
> You could first create the list of links in the controller and then pass 
> it to views via LOAD.
>
> Take a look at this (didn't test it but the idea should be clear):
>
> def getTags():
>     #get row object
>     tags = db().select(db.entry.tag,distinct=True)
>     #incialize taglist variable, start with <ul> tag
>     taglist = "<ul>"
>     #iterate over tags row and create the list of links
>     for t in tags:
>         taglist += "<li><a href='controller/function/" + t.id + "'>" + 
> t.name + "</a></li>"
>     #add closing </ul> tag at the end
>     taglist += "</ul>"
>     return XML(taglist)
>
>
>
> On Friday, July 26, 2013 4:55:29 PM UTC+2, John Stricker wrote:
>>
>> I'm trying to display unique entry tags on all pages of a website in a 
>> bar on the left side. It seems the best place to put this info is in the 
>> 'default.html', which could call a function using LOAD. 
>>
>> So in the controller i have: 
>>
>> def getTags():
>>     """get a list of distinct entry tags"""
>>     return db().select(db.entry.tag,distinct=True)
>>
>> then in the default.html i have:
>>
>>  {{tags = LOAD('default','getTags')}}
>>
>> it looks like the info is getting through, as when i can print out the 
>> list in default.html with {{=tags}} (which gives a bold header of 
>> 'entry.tag' followed by all unique values) but its unclear how to iterate 
>> over each of the values within the returned object. I'm guessing this is 
>> returning a row object? How do I iterate over it to create links for each 
>> unique entry?
>>
>>

-- 

--- 
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