[Zope] Re: Finding stylesheet

Tres Seaver tseaver at palladion.com
Mon Mar 20 11:03:11 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Poltorak wrote:
> I would like to set up a page template to use the stylesheet my.css if it 
> is in the current folder, but if not to use the one in the root folder.
> 
> How do I specify this?

Assuming that you mean "containing" folder (rather than root), you can
just acquire the object and ask for its absolute_url, e.g::

  <link type="text/css" href="my.css"
        tal:attributes="href string:${context/my.css/absolute_url}" />

If you want the local one, or one in some "root" folder (but not any
intervening ones), then you probably need to write a PythonScript which
finds the stylesheet file object using whatever logic is appropriate,
and return its absolute_url.  You would then call that script in TAL::

  <link type="text/css" href="my.css"
        tal:attributes="href string:${context/find_stylesheet_url}" />


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEHtI/+gerLs4ltQ4RAhuiAJ9A7LQmFt+9u2cf6MU7TY5zRlwAHgCgrtow
5d1w6G7vKqrH2hTsqsXdGgU=
=pYTJ
-----END PGP SIGNATURE-----



More information about the Zope mailing list