Acquisition isn't always bandwidth and browser-cache friendly, advice needed
Hi, I have recently started working with Zope and I am in the process of building an intranet information site with it. The Acquisition paradigm is very powerful and interesting but I have a few remarks about its efficiency bandwidth-wise My site will mostly be composed of internal corporate documents, classified into folder, subfolders etc. I want a corporate logo to appear in top of each page. Therefore I have created a "logo" object in the top "images" folder, and each document uses the tag: <dtml-var "images.logo"> Now the big trouble : suppose I have lots of documents and a deep tree of folder, the HTML tags I get in each page are: <img src="MY_SITE/Chapter1/images/logo"> <img src="MY_SITE/Chapter1/Subchapter1/images/logo"> <img src="MY_SITE/Chapter1/Subchapter2/images/logo"> <img src="MY_SITE/Chapter1/Subchapter3/images/logo"> <img src="MY_SITE/Chapter1/Subchapter3/Subsubchapter3/imags/logo"> <img src="MY_SITE/Chapter2/images/logo"> <img src="MY_SITE/Chapter2/Subchapter1/images/logo"> etc. The same document appears on the site with dozens of different names, is transfered over the network dozens of times and encumbers the browser memory and disk cache dozens of times! How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images? Thanks -- Farzad FARID <farzy@via.ecp.fr> Ingénieur Informatique Libre Alcôve - http://www.alcove.fr/
I don't know if this is the _best_ solution, but it should solve the problem you are addressing: Since you already have a lot of files asking for <dtml-var "images.logo">, you could create a dtml method in your root folder called "images.logo" that looks like the following: <img src="<dtml-var BASE0>/images/logo"> As a bonus, you could make it link the image to your top page: <a href="<dtml-var BASE0>/index_html"><img src="<dtml-var BASE0>/images/logo" border="0"></a> This way, you can still acquire images.logo, but have it call the same URL for the image every time. -- Jim Washington Farzad Farid wrote:
Hi,
I have recently started working with Zope and I am in the process of building an intranet information site with it. The Acquisition paradigm is very powerful and interesting but I have a few remarks about its efficiency bandwidth-wise
My site will mostly be composed of internal corporate documents, classified into folder, subfolders etc. I want a corporate logo to appear in top of each page. Therefore I have created a "logo" object in the top "images" folder, and each document uses the tag: <dtml-var "images.logo">
Now the big trouble : suppose I have lots of documents and a deep tree of folder, the HTML tags I get in each page are: <img src="MY_SITE/Chapter1/images/logo"> <img src="MY_SITE/Chapter1/Subchapter1/images/logo"> <img src="MY_SITE/Chapter1/Subchapter2/images/logo"> <img src="MY_SITE/Chapter1/Subchapter3/images/logo"> <img src="MY_SITE/Chapter1/Subchapter3/Subsubchapter3/imags/logo"> <img src="MY_SITE/Chapter2/images/logo"> <img src="MY_SITE/Chapter2/Subchapter1/images/logo"> etc.
The same document appears on the site with dozens of different names, is transfered over the network dozens of times and encumbers the browser memory and disk cache dozens of times!
How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images?
Thanks
-- Farzad FARID <farzy@via.ecp.fr> Ingénieur Informatique Libre Alcôve - http://www.alcove.fr/
On 11/14/99 9:20 AM, Farzad Farid at farzy@via.ecp.fr wrote:
How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images?
This problem is already solved if you do: <dtml-var logo> It will insert the absolute location, non acquired. This was fixed a while back. You can also do this: <dtml-var expr="logo.tag(align='right')"> This will add the "align=right" to the <IMG> tag generated. Chris -- | Christopher Petrilli Python Powered Digital Creations, Inc. | petrilli@digicool.com http://www.digicool.com
On Sun, Nov 14, 1999, Christopher Petrilli wrote:
On 11/14/99 9:20 AM, Farzad Farid at farzy@via.ecp.fr wrote:
How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images?
This problem is already solved if you do:
<dtml-var logo>
But then I have to put the logo in the root folder. Or is there a syntax for still accessing the logo in the 'images' folder?
It will insert the absolute location, non acquired. This was fixed a while back. You can also do this:
It does insert the absolute URL, but it is still acquired... If I chek the source of the generated page for my DTML document "/AlcoveInterne/Outline/glop1/index_html" I see : <img src="http://localhost:8080/AlcoveInterne/Outline/glop1/logo" width="601" height="72" alt="Alcove - L'informatique est libre"> where I'd be expecting : src="http://localhost:8080/AlcoveInterne/logo" Am I still doing something wrong? FYI I'm using Zope 2.0.0. Regards -- Farzad FARID <farzy@via.ecp.fr> Ingénieur Informatique Libre Alcôve - http://www.alcove.fr/
On 11/14/99 11:35 AM, Farzad Farid at farzy@via.ecp.fr wrote:
On Sun, Nov 14, 1999, Christopher Petrilli wrote:
On 11/14/99 9:20 AM, Farzad Farid at farzy@via.ecp.fr wrote:
How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images?
This problem is already solved if you do:
<dtml-var logo>
But then I have to put the logo in the root folder. Or is there a syntax for still accessing the logo in the 'images' folder?
No you can use: <dtml-var Images.logo> or even: <dtml-var expr="Images[page_logo].tag(align='right')">
It does insert the absolute URL, but it is still acquired... If I chek the source of the generated page for my DTML document "/AlcoveInterne/Outline/glop1/index_html" I see : <img src="http://localhost:8080/AlcoveInterne/Outline/glop1/logo" width="601" height="72" alt="Alcove - L'informatique est libre">
where I'd be expecting : src="http://localhost:8080/AlcoveInterne/logo"
Am I still doing something wrong? FYI I'm using Zope 2.0.0.
Oops, this is a bug resolved in 2.1 :-) Sorry... Chris -- | Christopher Petrilli Python Powered Digital Creations, Inc. | petrilli@digicool.com http://www.digicool.com
Farzad Farid wrote:
<dtml-var logo>
But then I have to put the logo in the root folder. Or is there a syntax for still accessing the logo in the 'images' folder?
<dtml-with images> <dtml-var logo> </dtml-with> or: <IMG SRC="<dtml-var "images.logo.absolute_url()">"> might do the trick. -- Ethan "mindlace" Fremen you cannot abdicate responsibility for your ideology.
Christopher Petrilli wrote:
On 11/14/99 9:20 AM, Farzad Farid at farzy@via.ecp.fr wrote:
How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images?
This problem is already solved if you do:
<dtml-var logo>
It will insert the absolute location, non acquired. This was fixed a while back. You can also do this:
The problem with this is that your images need to reside in the root folder, which can get cluttered if you have a lot of graphics. More that one person has thought of creating an images folder at the root level, which then necessitates: <dtml-var "images.logo">, <dtml-var "PARENTS[-1].images.logo">, or <dtml-with images><dtml-var logo></dtml-with>. Only the middle of these three gives you an absolute path name on the image. At least that's what I've discovered. There may be a more elegant solution :-) Cheers... Bruce -- Bruce Elrick, Ph.D. Saltus Technology Consulting Group Personal: belrick@home.com IBM Certified Specialist Business: belrick@saltus.ab.ca ADSM, AIX Support, RS/6000 SP, HACMP
Farzad Farid wrote:
Hi,
I have recently started working with Zope and I am in the process of building an intranet information site with it. The Acquisition paradigm is very powerful and interesting but I have a few remarks about its efficiency bandwidth-wise
My site will mostly be composed of internal corporate documents, classified into folder, subfolders etc. I want a corporate logo to appear in top of each page. Therefore I have created a "logo" object in the top "images" folder, and each document uses the tag: <dtml-var "images.logo">
Now the big trouble : suppose I have lots of documents and a deep tree of folder, the HTML tags I get in each page are: <img src="MY_SITE/Chapter1/images/logo"> <img src="MY_SITE/Chapter1/Subchapter1/images/logo"> <img src="MY_SITE/Chapter1/Subchapter2/images/logo"> <img src="MY_SITE/Chapter1/Subchapter3/images/logo"> <img src="MY_SITE/Chapter1/Subchapter3/Subsubchapter3/imags/logo"> <img src="MY_SITE/Chapter2/images/logo"> <img src="MY_SITE/Chapter2/Subchapter1/images/logo"> etc.
The same document appears on the site with dozens of different names, is transfered over the network dozens of times and encumbers the browser memory and disk cache dozens of times!
How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images?
I use <dtml-var "PARENTS[-1].Graphics.logo_png"> etc. It causes the graphics to alwqays have the same URL and thus be cachable. Note this is one of those cases where it is best not to have periods in the object name. Cheers... Bruce -- Bruce Elrick, Ph.D. Saltus Technology Consulting Group Personal: belrick@home.com IBM Certified Specialist Business: belrick@saltus.ab.ca ADSM, AIX Support, RS/6000 SP, HACMP
Farzad Farid wrote:
Hi,
I have recently started working with Zope and I am in the process of building an intranet information site with it. The Acquisition paradigm is very powerful and interesting but I have a few remarks about its efficiency bandwidth-wise
My site will mostly be composed of internal corporate documents, classified into folder, subfolders etc. I want a corporate logo to appear in top of each page. Therefore I have created a "logo" object in the top "images" folder, and each document uses the tag: <dtml-var "images.logo">
Now the big trouble : suppose I have lots of documents and a deep tree of folder, the HTML tags I get in each page are:
...
The same document appears on the site with dozens of different names, is transfered over the network dozens of times and encumbers the browser memory and disk cache dozens of times!
How can this problem be solved elegantly without completely putting aside the acquisition process? How can I do it in this particular case with images?
<img src=/images/logo> gives it the same URL everytime. IN this case, I don't see why you would need aquisition, since AFAIK, that is what causes the relative urls you don't want. -- "They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown." -- Carl Sagan
On Mon, Nov 15, 1999, Bill Anderson wrote:
<img src=/images/logo> gives it the same URL everytime. IN this case, I don't see why you would need aquisition, since AFAIK, that is what causes the relative urls you don't want.
You are right, I don't need acquisition in this case, but by using your syntax I lose the automatic insertion of the 'alt', 'width' and 'height' params :) So choosing between the plain HTML syntax and the object method is not that easy. -- Farzad FARID <farzy@via.ecp.fr> Ingénieur Informatique Libre Alcôve - http://www.alcove.fr/
On 11/14/99 6:59 PM, Farzad Farid at farzy@via.ecp.fr wrote:
You are right, I don't need acquisition in this case, but by using your syntax I lose the automatic insertion of the 'alt', 'width' and 'height' params :) So choosing between the plain HTML syntax and the object method is not that easy.
The lack of absolute URLs being inserted was a BUG in 2.0, and is resolved in the CVS repository and should be in 2.1b2. Chris -- | Christopher Petrilli Python Powered Digital Creations, Inc. | petrilli@digicool.com http://www.digicool.com
participants (6)
-
Bill Anderson -
Bruce Elrick -
Christopher Petrilli -
Ethan Fremen -
Farzad Farid -
Jim Washington