[Zope] Chicken or Egg Syndrome

Oliver Bleutgen myzope@gmx.net
Fri, 26 Oct 2001 17:02:33 +0200


Ben Ocean wrote:

> Hi;
> I want to simply_and_elegantly achieve the following:
>
> 1. Ping the visitor's browser to determine screen resolution (easy: I 
> know how to capture this).
> 2. Redirect them to a folder such as 800 or 1024 depending on the res 
> (easy again).
> 3. Assign a variable within that folder via a dtml method that will be 
> used to size elements such as image width and height (easy again).
> 4. Place all the documents that will need that variable in a lower 
> folder, so that I don't have to copy all the dtml documents into 
> folders 800 and 1024 (ah: not so easy! at least not for me).
>
> The problem appears to be that I need to cull a variable out of a 
> Javascript that I can in turn utilize in a dtml method.So, how do I do 
> this?
> TIA,
> BenO

Why don't you use a layout like
/
   /folder_800
   /folder_1024
   /content

And just acquire content in the right position
i.e. folder_800/content/blabla => 800 optimized
and folder_1024/content/blabla => 1024 optimzed

where blabla's physical location is /content/blabla

Now give folder_800, folder_1024 and content a int property, say "res".
Then you only need javscript in your start page, the rest can be constructed
solely in zope, without javascript, like <img src='fdf' width=<dtml-var 
"res/100">>.
Additionally you can use the content folder for browsers without javascript.

cheers,
oliver