Hi there, I've been struggling with something that must be very basic, but I just don't get it. Hopefully, there's somebody out there who could enlighten me a little... I have this site hierarchy, something like this: /top /top/section1/ /top/section1/chapter1 /top/section1/chapter1/paragraph1 /top/section1/chapter1/paragraph2 /top/section1/chapter2 /top/section1/chapter2/paragraph1 /top/section2/ /top/section2/chapter1 /top/section2/chapter1/paragraph1 etc. These are all folders with an index_html inside them. The template will have, among other things, a site title image, a section title image, and a page title image for each page. The idea here is to be able to create a folder img/ at appropriate levels of this hierarchy and use images section_title.gif, chapter_title.gif, page_title.gif, etc. This might be where I've misunderstood everything, but I was hoping to do something like this: <img src="dummy.gif" class="title-img" tal:define="image here/img/section_title.gif" tal:attributes="src image/absolute_url" /> If for instance looking at one of the paragraph pages, the template would then, in my perfect world, start looking for an "img/" folder at the current level, and within it a file named "section_title.gif", and if it does not find it, it will try again one level up in the hierarchy, until it then finds the section_title.gif in the folder /top/section1/img/section_title.gif. Same goes for the other images, but they would "hit" further down in the hierarchy so that I could effectively let a "closer" image override one with the same name, but further up. Have I got it completely wrong? Is my thinking right, but my syntax wrong? Haven't been able to get anywhere on this - all documentation I can find gives hints and pointers, but I'm still stuck... Any help & comments highly appreciated! Best regards Jan
Each element of the path is acquired in turn, and acquisition doesn't backtrack when something cannot be found. So in this case, it starts at the current level and looks for "img", and finds it. So far so good! Then, it starts from that img folder and looks for your image "section_title.gif". It's not here! So, acquisition will move on to search the parent of the img folder, and the parent of that, and so on. Your section title image can't be found anywhere! Result: Not found. At no point will the process backtrack and try other possible "img" folders - when you say "img", you get the first one that can be acquired, and then that's that. To acquire images in the way you describe, you would need to do away with your "img" folders, and include the images directly in each folder in your hierarchy. Thanks, Malcolm. On Mon, 31 Jan 2005 14:40:43 +0000, Jan Bruvoll wrote:
Hi there,
I've been struggling with something that must be very basic, but I just don't get it. Hopefully, there's somebody out there who could enlighten me a little...
I have this site hierarchy, something like this:
/top /top/section1/ /top/section1/chapter1 /top/section1/chapter1/paragraph1 /top/section1/chapter1/paragraph2 /top/section1/chapter2 /top/section1/chapter2/paragraph1 /top/section2/ /top/section2/chapter1 /top/section2/chapter1/paragraph1
etc.
These are all folders with an index_html inside them. The template will have, among other things, a site title image, a section title image, and a page title image for each page.
The idea here is to be able to create a folder img/ at appropriate levels of this hierarchy and use images section_title.gif, chapter_title.gif, page_title.gif, etc. This might be where I've misunderstood everything, but I was hoping to do something like this:
<img src="dummy.gif" class="title-img" tal:define="image here/img/section_title.gif" tal:attributes="src image/absolute_url" />
If for instance looking at one of the paragraph pages, the template would then, in my perfect world, start looking for an "img/" folder at the current level, and within it a file named "section_title.gif", and if it does not find it, it will try again one level up in the hierarchy, until it then finds the section_title.gif in the folder /top/section1/img/section_title.gif. Same goes for the other images, but they would "hit" further down in the hierarchy so that I could effectively let a "closer" image override one with the same name, but further up.
Have I got it completely wrong? Is my thinking right, but my syntax wrong? Haven't been able to get anywhere on this - all documentation I can find gives hints and pointers, but I'm still stuck...
Any help & comments highly appreciated!
Best regards Jan
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) --
[] j a m k i t web solutions for charities malcolm cleaton T: 020 7549 0520 F: 020 7490 1152 M: 07986 563852 W: www.jamkit.com
Hi Malcolm, thanks for your very quick reply. So - if I want to do it "my way", I'd have to write a quick python method that does the searching for me, I presume. However, I already tried doing away with the folders and putting those images directly into the folders, so that there are images across the site like this: /top /top/site-title.gif /top/section1/ /top/section1/section-title.gif /top/section1/chapter1 /top/section1/chapter1/page-title.gif /top/section1/chapter1/paragraph1 /top/section1/chapter1/paragraph1/page-title.gif ... It works in those folders where the relevant images actually are, but the traversal does not kick in. Any pointers to this as well maybe? Thanks again Best regards Jan Malcolm Cleaton wrote:
Each element of the path is acquired in turn, and acquisition doesn't backtrack when something cannot be found.
So in this case, it starts at the current level and looks for "img", and finds it. So far so good! Then, it starts from that img folder and looks for your image "section_title.gif". It's not here! So, acquisition will move on to search the parent of the img folder, and the parent of that, and so on. Your section title image can't be found anywhere! Result: Not found. At no point will the process backtrack and try other possible "img" folders - when you say "img", you get the first one that can be acquired, and then that's that.
To acquire images in the way you describe, you would need to do away with your "img" folders, and include the images directly in each folder in your hierarchy.
Thanks, Malcolm.
On Mon, 31 Jan 2005 14:40:43 +0000, Jan Bruvoll wrote:
Hi there,
I've been struggling with something that must be very basic, but I just don't get it. Hopefully, there's somebody out there who could enlighten me a little...
I have this site hierarchy, something like this:
/top /top/section1/ /top/section1/chapter1 /top/section1/chapter1/paragraph1 /top/section1/chapter1/paragraph2 /top/section1/chapter2 /top/section1/chapter2/paragraph1 /top/section2/ /top/section2/chapter1 /top/section2/chapter1/paragraph1
etc.
These are all folders with an index_html inside them. The template will have, among other things, a site title image, a section title image, and a page title image for each page.
The idea here is to be able to create a folder img/ at appropriate levels of this hierarchy and use images section_title.gif, chapter_title.gif, page_title.gif, etc. This might be where I've misunderstood everything, but I was hoping to do something like this:
<img src="dummy.gif" class="title-img" tal:define="image here/img/section_title.gif" tal:attributes="src image/absolute_url" />
If for instance looking at one of the paragraph pages, the template would then, in my perfect world, start looking for an "img/" folder at the current level, and within it a file named "section_title.gif", and if it does not find it, it will try again one level up in the hierarchy, until it then finds the section_title.gif in the folder /top/section1/img/section_title.gif. Same goes for the other images, but they would "hit" further down in the hierarchy so that I could effectively let a "closer" image override one with the same name, but further up.
Have I got it completely wrong? Is my thinking right, but my syntax wrong? Haven't been able to get anywhere on this - all documentation I can find gives hints and pointers, but I'm still stuck...
Any help & comments highly appreciated!
Best regards Jan
Hi again, forget it - I'm just being daft. Of course it works - had just moved the images around a little too much in my desperation. Thanks for the update on the way the traversal works - everything's a little clearer now! Best regards Jan Jan Bruvoll wrote:
Hi Malcolm,
thanks for your very quick reply.
So - if I want to do it "my way", I'd have to write a quick python method that does the searching for me, I presume.
However, I already tried doing away with the folders and putting those images directly into the folders, so that there are images across the site like this:
/top /top/site-title.gif /top/section1/ /top/section1/section-title.gif /top/section1/chapter1 /top/section1/chapter1/page-title.gif /top/section1/chapter1/paragraph1 /top/section1/chapter1/paragraph1/page-title.gif ...
It works in those folders where the relevant images actually are, but the traversal does not kick in. Any pointers to this as well maybe?
Thanks again
Best regards Jan
Malcolm Cleaton wrote:
Each element of the path is acquired in turn, and acquisition doesn't backtrack when something cannot be found.
So in this case, it starts at the current level and looks for "img", and finds it. So far so good! Then, it starts from that img folder and looks for your image "section_title.gif". It's not here! So, acquisition will move on to search the parent of the img folder, and the parent of that, and so on. Your section title image can't be found anywhere! Result: Not found. At no point will the process backtrack and try other possible "img" folders - when you say "img", you get the first one that can be acquired, and then that's that.
To acquire images in the way you describe, you would need to do away with your "img" folders, and include the images directly in each folder in your hierarchy.
Thanks, Malcolm.
On Mon, 31 Jan 2005 14:40:43 +0000, Jan Bruvoll wrote:
Hi there,
I've been struggling with something that must be very basic, but I just don't get it. Hopefully, there's somebody out there who could enlighten me a little...
I have this site hierarchy, something like this:
/top /top/section1/ /top/section1/chapter1 /top/section1/chapter1/paragraph1 /top/section1/chapter1/paragraph2 /top/section1/chapter2 /top/section1/chapter2/paragraph1 /top/section2/ /top/section2/chapter1 /top/section2/chapter1/paragraph1
etc.
These are all folders with an index_html inside them. The template will have, among other things, a site title image, a section title image, and a page title image for each page.
The idea here is to be able to create a folder img/ at appropriate levels of this hierarchy and use images section_title.gif, chapter_title.gif, page_title.gif, etc. This might be where I've misunderstood everything, but I was hoping to do something like this:
<img src="dummy.gif" class="title-img" tal:define="image here/img/section_title.gif" tal:attributes="src image/absolute_url" />
If for instance looking at one of the paragraph pages, the template would then, in my perfect world, start looking for an "img/" folder at the current level, and within it a file named "section_title.gif", and if it does not find it, it will try again one level up in the hierarchy, until it then finds the section_title.gif in the folder /top/section1/img/section_title.gif. Same goes for the other images, but they would "hit" further down in the hierarchy so that I could effectively let a "closer" image override one with the same name, but further up.
Have I got it completely wrong? Is my thinking right, but my syntax wrong? Haven't been able to get anywhere on this - all documentation I can find gives hints and pointers, but I'm still stuck...
Any help & comments highly appreciated!
Best regards Jan
participants (2)
-
Jan Bruvoll -
Malcolm Cleaton