Using folder name in macro
How do I use a folder name in a macro? ie I want to change this <metal:macro metal:use-macro="context/abc.pt/macros/page"> which is in the folder 'abc' to <metal:macro metal:use-macro="context/[folder_name].pt/macros/page"> I don't know where to look this sort of thing up. -- John
--On 13. März 2006 10:21:15 +0000 John Poltorak <jp@warpix.org> wrote:
How do I use a folder name in a macro?
ie I want to change this
<metal:macro metal:use-macro="context/abc.pt/macros/page">
which is in the folder 'abc'
to
<metal:macro metal:use-macro="context/[folder_name].pt/macros/page">
Your question makes little or no sense. <metal:macro metal:use-macro="context/abc.pt/macros/page"> ^^^^^^^^^^^^^ This part of the of the value is nothing else than a path expression defining the path to some ZPT using acquisition. The 'macros' referes to the ZPTs internal 'macros' datastructure and 'page' is the name of macro to be used. -aj ----------------------------------------------------------------------- - Andreas Jung ZOPYX Ltd. & Co KG - - E-mail: info@zopyx.com Web: www.zopyx.com, www.zopyx.de - -----------------------------------------------------------------------
On Mon, Mar 13, 2006 at 11:27:19AM +0100, Andreas Jung wrote:
--On 13. März 2006 10:21:15 +0000 John Poltorak <jp@warpix.org> wrote:
How do I use a folder name in a macro?
ie I want to change this
<metal:macro metal:use-macro="context/abc.pt/macros/page">
which is in the folder 'abc'
to
<metal:macro metal:use-macro="context/[folder_name].pt/macros/page">
Your question makes little or no sense.
Rather than telling me how stupid I am, how about trying to figure out what I'm having difficulty achieving?
-aj
-- John
John Poltorak wrote:
<metal:macro metal:use-macro="context/[folder_name].pt/macros/page">
<metal:macro metal:use-macro="python:getattr(context,folder_name+'.pt').macros['page']"> If you end up doing this, I would suggest your application design is pretty broken and should be thought out different :-/ Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Hi John, John Poltorak wrote:
How do I use a folder name in a macro?
ie I want to change this
<metal:macro metal:use-macro="context/abc.pt/macros/page">
This is a path expression with a file (abc.pt) and path ("context/", signifying the context of the call)...
which is in the folder 'abc'
...so you must have "/abc/abc.pt"
to
<metal:macro metal:use-macro="context/[folder_name].pt/macros/page">
In your example, you seem to have confused the file and folder - I suspect you want something more like: - <metal:macro metal:use-macro="context/[folder_name]/abc.pt/macros/page"> ...meaning "the macro "page" in the file "abc.pt" in the folder "folder_name", with all the usual caveats about acquisition.
I don't know where to look this sort of thing up.
I generally start with the examples in the latest (?) Zope book (2.7) on Plope.org. The reference is appendix C: - http://www.plope.com/Books/2_7Edition/AppendixC.stx HTH! -- Regards, PhilK Email: phil@xfr.co.uk PGP Public key: http://www.xfr.co.uk Voicemail & Facsimile: 07092 070518 "You'll find that one part's sweet and one part's tart: say where the sweetness and the sourness start." - Tony Harrison
participants (4)
-
Andreas Jung -
Chris Withers -
John Poltorak -
Philip Kilner