Newbie question: graphics in subdirs
I'm going to rewrite my web site in dtml and am using the latest stable Zope. Well, I should say I'll rewrite it after I get over this infuriating newbie problem I have. :-) ` I'm trying to get Zope to display an image from a subdir. I've whipped up a simple dtml document called "test". Test contains this: <dtml-var standard_html_header> <h2><dtml-var title_or_id></h2> <p>This is the <dtml-var id> Document.</p> <p>Now show a graphic: <br> <dtml-var logo.jpg> </p> <dtml-var standard_html_footer> That references an image file in the root directory called logo.jpg. Everything works, it displays fine. However, I want to keep all of my commonly used image files in a subdirectory called /images. So I create a folder called "images", upload another copy of logo.jpg into it, everything's fine. I change the dtml in the "test" document to be "<dtml-var /images/logo.jpg>". And it doesn't work, giving me an error message of: Error Type: KeyError Error Value: /images/logo.jpg Looking through the docs and tutorials I can't find anything on this -- and I know it's mindlessly simple. Can someone whack me with a clue-bat? TIA. -- Regards, | Debian GNU/ __ o http://www.debian.org . | / / _ _ _ _ _ __ __ Randy | / /__ / / / \// //_// \ \/ / (redwards@golgotha.net) | /____/ /_/ /_/\/ /___/ /_/\_\ http://www.golgotha.net | because lockups should only be for convicts.
+----[ Randy Edwards ]--------------------------------------------- | I'm going to rewrite my web site in dtml and am using the latest stable | Zope. Well, I should say I'll rewrite it after I get over this infuriating | newbie problem I have. :-) | ` | I'm trying to get Zope to display an image from a subdir. I've whipped up a | simple dtml document called "test". Test contains this: | | <dtml-var standard_html_header> | <h2><dtml-var title_or_id></h2> | <p>This is the <dtml-var id> Document.</p> | <p>Now show a graphic: <br> | <dtml-var logo.jpg> | </p> | <dtml-var standard_html_footer> There's more than one way to skin the cat, however:- You have a '.' in your id which means doing stuff like:- <dtml-var "images.logo_jpg"> are out in any clean way. You can <img src="/images/logo.jpg"> which will also work. You can say; <dtml-with images> <dtml-var logo.jpg> </dtml-with> -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
<snip>
However, I want to keep all of my commonly used image files in a subdirectory called /images. So I create a folder called "images", upload another copy of logo.jpg into it, everything's fine. I change the dtml in the "test" document to be "<dtml-var /images/logo.jpg>". And it doesn't work, giving me an error message of:
Error Type: KeyError Error Value: /images/logo.jpg
Looking through the docs and tutorials I can't find anything on this -- and I know it's mindlessly simple. Can someone whack me with a clue-bat? TIA.
<whack> 1. Don't use URL separators in dtml expressions. Use dots 2. You shouldn't have used dots in the logo.jpg name as it confuses zope, look below what that gets you ;-): <dtml-var "images._['logo.jpg']"> sorry 'bout that (untested, but should work) </whack> Rik
At 11:35 am -0400 7/6/00, Randy Edwards wrote:
<dtml-var standard_html_header> <h2><dtml-var title_or_id></h2> <p>This is the <dtml-var id> Document.</p> <p>Now show a graphic: <br> <dtml-var logo.jpg> </p> <dtml-var standard_html_footer>
That references an image file in the root directory called logo.jpg. Everything works, it displays fine.
However, I want to keep all of my commonly used image files in a subdirectory called /images. So I create a folder called "images", upload another copy of logo.jpg into it, everything's fine. I change the dtml in the "test" document to be "<dtml-var /images/logo.jpg>". And it doesn't work, giving me an error message of:
try <dtml-with images> <dtml-var logo.jpg> </dtml-with> It can get complex quickly though - I'm sure I remember something on thew Zope list about this, I think it was a word of wisdom from Phil Harris... 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
eh tone, your using my name in vain again ;) ----- Original Message ----- From: "Tony McDonald" <tony.mcdonald@ncl.ac.uk> To: <redwards@golgotha.net>; "Zope List" <zope@zope.org> Sent: 07 June 2000 16:56 Subject: Re: [Zope] Newbie question: graphics in subdirs
At 11:35 am -0400 7/6/00, Randy Edwards wrote:
<dtml-var standard_html_header> <h2><dtml-var title_or_id></h2> <p>This is the <dtml-var id> Document.</p> <p>Now show a graphic: <br> <dtml-var logo.jpg> </p> <dtml-var standard_html_footer>
That references an image file in the root directory called logo.jpg. Everything works, it displays fine.
However, I want to keep all of my commonly used image files in a subdirectory called /images. So I create a folder called "images", upload another copy of logo.jpg into it, everything's fine. I change the dtml in the "test" document to be "<dtml-var /images/logo.jpg>". And it doesn't work, giving me an error message of:
try <dtml-with images> <dtml-var logo.jpg> </dtml-with>
It can get complex quickly though - I'm sure I remember something on thew Zope list about this, I think it was a word of wisdom from Phil Harris...
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
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (5)
-
Andrew Kenneth Milton -
Phil Harris -
Randy Edwards -
Rik Hoekstra -
Tony McDonald