Jim Steil wrote:
> def makeTeamLink(team):
>     link = Element('a',href='/team/%d' % team.id)
>     link.text = team
>     return link
> 
> What I want to be able to do is have an image to click on instead of the 
> text.  In normal HTML, I'd do this by wrapping an image tag inside of an 
> anchor tag.  Does anyone know of a way to build an Element to generate 
> this html?  I've tried a couple things, but haven't hit upon the right 
> combination.

Solution 1)

link = Element('a', href='/team/%d' % team.id)
link.text = team
img = Element('img', src='myimg.gif')
img.append(link)

Solution 2)

img = XML('<img src="myimg.gif"><a href="/team/%d"/>%s</img>'
     % (team.id, team))

Where XML must be imported from kid, of course.

-- Chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to