[Zope] Re: METAL question: relative reference to a macro defined in the same file

Johan Carlsson johanc at easypublisher.com
Fri Apr 9 07:34:56 EDT 2004


Tonico Strasser wrote:
> Johan Carlsson wrote:
> I still do not understand why you want to move your presentation 
> templates around. If your template is in a folder at the root of your 
> site, let's say 'templates', you wouldn't need to change the path from 
> other templates referring to it when you move them.

Well, first the template is in a skin and second I know by experience 
things may change (for anyway , like renaming or moving things around, 
maybe reusing the template by coping it and change it in
another location.

you can compare it to using absolute URLs or relative URLs in a
collection of HTML pages. Using relative references you can move
the collection without breaking the internal references.
This is quite useful, for instance if you distribute the collection
and you can't know on for hand where the user will unpack it.

What I want is the same functionality in TAL and METAL.
You have the "template" reference that points on the calling template,
why not have a "current_template" (or something) that points the 
template that the code is being executed.

The reason I want this is because I was working on a template and
found my self in the situation that the code was becoming more and
more complicated and it was hard to have an overview.
So I factored out one part that was occuring in several places,
making the "code" much more readable. I put the out-factored part
in a macro definition in the same file, but to use it I was required
to enter the complete path to the template (e.g. 
"here/skin_path/current_temp/macros/macro_name"), what I would like
to do is "current/macros/macro_name", because the macro is local.

Was that clearer?
Johan


-- 
Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM     Skype: colliberty





More information about the Zope mailing list