Newbie dtml-var question (probably...)
Hi, I'd like to do something like: <dtml-var /images/logo> to include a logo and get the alt text from the object, etc, but it doesn't work. Any ideas? Also, and I've read a few threads about this but none really made sense to me, I work on sites at home and at work, with varying base URLS. 1. At home, URLs are something like localhost:8080/project/index.html 2. At work, they are something like zope.nipltd.com/project/index.html 3. And finally, the sites are often also presented as something like www.project.com. The problem is how to phrase URLs in hrefs. <A HREF="/index.html"> does not work for cases 1 and 2 as it goes to the root index.html on the server. however, it is the only way I can think to do links that work for case 3. This also applies to images if you reference them using <IMG> tags, which is how I'm currently dealing with the first problem (not nice, 'cos you have to maintain image size, alt text, etc by hand...) Any help greatfully recieved... Chris
At 11:02 am +0000 15/2/00, Chris Withers wrote:
Hi,
I'd like to do something like:
<dtml-var /images/logo>
Is images a folder? <dtml-with images> <dtml-var logo> </dtml-with> or <dtml-var "images.logo"> (*should* work, may need to add () to the end of logo) There's other voodoo you can do (rhymes! :) with images. Look at lib/python/OFS/Image.py and look for def tag for more detail then you ever wanted to know...
Also, and I've read a few threads about this but none really made sense to me, I work on sites at home and at work, with varying base URLS.
1. At home, URLs are something like localhost:8080/project/index.html
2. At work, they are something like zope.nipltd.com/project/index.html
3. And finally, the sites are often also presented as something like www.project.com.
The problem is how to phrase URLs in hrefs. <A HREF="/index.html"> does not work for cases 1 and 2 as it goes to the root index.html on the server. however, it is the only way I can think to do links that work for case 3. This also applies to images if you reference them using <IMG> tags, which is how I'm currently dealing with the first problem (not nice, 'cos you have to maintain image size, alt text, etc by hand...)
Check out usage of URL and BASE at the Zope site. They help to make sites cleaner. <dtml-var image> does a lot of work for you. Downside is that you need all your images in the Zope database. hth tone ------ Dr Tony McDonald, FMCC, Networked Learning Environments Project http://nle.ncl.ac.uk/ The Medical School, Newcastle University Tel: +44 191 222 5888 Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2
participants (2)
-
Chris Withers -
Tony McDonald