On Apr 20, 2012, at 6:24 AM, Simon Pickles wrote:
Thanks I suspected my path was a little wrong.
Still got the problem that the image border appears then whole thing vanishes.
Assuming that your app is set as the default, try:
img src=/static/images/map420x200.png style=border: 2px; width:420px;
height:200px;/
otherwise:
img src=/myapp/static/images/map420x200.png style=border: 2px; width:420px;
height:200px;/
If you leave out the leading slash, the browser interprets the URL as being
relative to the current page, which is not likely to be right (unless the
current page is / or /myapp).
However, you're better off letting URL handle the details for you, especially
if you ever enable URL routing. You can pass your style argument to IMG by
renaming it _style, or use img... and embed URL in that:
img src={{=URL(...)}}...
On Friday, 20 April 2012 08:19:23 UTC+1, Simon Pickles wrote:
Hi,
New to web2py and having trouble with simple HTML in a view. In my
default/index.html:
{{=IMG(_src=URL('static','images/map420x200.png'))}}
img src=static/images/map420x200.png style=border: 2px; width:420px;
height:200px;/
The first line works, rendering the map png. However, the second HTML
equivalent doesnt. The bordered box appears empty then disappears. Is my path
wrong?
The app is just created using wizard, and default layout.
Thanks
Simon