[Zope] Changing Contexts (Was: [Zope] Acquisition? Did I just lose my Zen?)
Anthony Baxter
Anthony Baxter <anthony@interlink.com.au>
Wed, 22 Sep 1999 17:36:00 +1000
>>> Michel Pelletier wrote
> > Is it possible to code a special kind of folder that changes the
> > aquisition order?
>
> One thing I'd like to point out here, is that you are getting into
> something very, very deep. This discussion has gone pretty far, but I
> still dont get it. What I want to see is a very, very trivial example
> of what you want to do, and why you can't do it now. There may be
> another solution.
I also haven't actually been able to figure out exactly what it is that's
being asked for. Is it something like this?
Say we have a web site in
/admin/web/.... and we want to have totally different look and feels
for the web site - different colors, fonts, logos, or whatever.
One way to do that is to put all the looknfeel specific elements into
a folder in, say, /admin, and then wrap the pages in
<dtml-with lf_foldername>
page contents here
</dtml-with>
or, if the looknfeel folder name is in a variable,
<dtml-with "_[looknfeel]">
page contents here
</dtml-with>
so say we have
/admin/
lf_prettycolors/
lf_prettycolors2/
lf_plainpages/
web/
content
inside each of the lf_ folders, you'd have a bunch of standard named
objects, e.g. a dtml method called 'header', another called 'footer',
maybe properties for 'font1name', 'font1size', 'font2', &c.
when calling the pages in /admin/web, I'm assuming there's a cookie,
or a form variable, or something, called 'looknfeel', that's set to,
for example 'lf_plainpages'.
A page in /admin/web could then look like
<dtml-with "_[looknfeel]">
<dtml-var header>
<font face="<dtml-var font1name>" size="<dtml-var font1size>">Welcome</font>
body here...
<dtml-var footer>
</dtml-with>
and it will pick up header, footer, font1name, and font1size from whichever
folder is named by the looknfeel string.
Obviously there's a lot more you can do here to make this cleaner, and more
managable, but there's a start...
Anthony