Re: [web2py] Re: Using static files in view confusion

2012-04-20 Thread Jonathan Lundell
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




Re: [web2py] Re: Using static files in view confusion

2012-04-20 Thread Simon Pickles
Thanks

Nice to see web2py has a helpful and lively community
On Apr 20, 2012 2:24 PM, Simon Pickles sipick...@gmail.com wrote:

 Thanks I suspected my path was a little wrong.

 Still got the problem that the image border appears then whole thing
 vanishes.

 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