On Monday, August 22, 2011 11:11:12 AM UTC-4, sagar wrote:

> I have triying like this but not succeeded yet, 
>  
> table += "<td>"+ str(A(_href=URL('a', 'preview')) , 
> IMG(_src=URL(r=request,c='static',f='images/preview.png'),_width="15", 
> _height="15" )) +"</td>"
>  
>
 
A few things:

   - Do you want the image itself to be a clickable link? If so, IMG() needs 
   to go inside A().
   - Inside A(), IMG() needs to come before _href (IMG is a positional 
   argument, so has to come before any keyword arguments).
   - Instead of concatenating strings, why not use web2py's TABLE(), TR(), 
   and TD() helpers? You can add new TDs to a row by using the append() method. 
   For example:

mytablerow.append(TD(A(IMG(_src=URL(...))))) 

See http://web2py.com/book/default/chapter/05#HTML-Helpers. Note, helpers 
act as lists with respect to their components (so you can use .append() to 
add components), and they act as dictionaries with regard to their 
attributes (so you can use .update() to add attributes).
 
Anthony
 

Reply via email to