I think the best way to address this problem is using the A tag, like this:
stored_code = A(request.vars.the_link, _href=request.vars.the_link)
or, if you insist
stored_code = XML("<a href='%(link)s'>%(link)s</a>" % {'link':
request.vars.the_link})
PS - I sure hope it's not a code sample, cauz you're just screeming for
hackers to spam you with links to thier website.
On Wednesday, March 20, 2013 7:16:14 PM UTC+2, Lamps902 wrote:
>
> It's possible to render HTML code stored in a variable with the XML()
> function (i.e. if your variable is "stored_code", do "XML(stored_code)"
> to render). However, let's say you have something like the following
> scenario:
>
> stored_code = "<a href='{{=request.vars.the_link}}'>{{=request.vars.
> the_link}}</a>"
>
> or something like
>
> stored_code = "<a href='request.vars.the_link'>request.vars.the_link</a>"
>
> Is there a way to get web2py to evaluate the variables and render the HTML
> with the evaluated values? 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.