On Tue, Jun 21, 2005 at 03:16:11PM -0500, J Cameron Cooper wrote: > John Poltorak wrote: > > If I create a macro which defines a slot called 'content', is there any > > way to have that slot populated by a file with a specific name if it > > exists in a folder? > > > > What I'd like to do is create a structure text file, in each of the > > folders A B C and have it automatically loaded into a content slot of a > > master template whenever the options A B C are selected. > > > > Can I do that, and if so how? > > > > I have spent all day looking at ZPT references and have no idea if what > > I'd like to do is possible. > > You don't have to involve macros:: > > <div>I'm a header</div> > > <p tal:condition="exists:context/stxfile" > tal:replace="structure context/stxfile/CookedBody"> > This is sample page content > </p> > > <div>I'm a footer</div> > > If 'stxfile' can be aquired, what it renders will be included as page > structure. (You may need to use a different method one the end of the > path to render the object; for Documents, this is 'CookedBody'.) > Otherwise, nothing will be rendered, though you could add a block with > the oposite condition to supply a default action.
Is 'stxfile' the actual filename? I'm not concerned about it being structured initially - just want to see it working in principle with any file containg some text. > If you do not want the effects of acquisition, you may say instead:: > > tal:condition="exists:context/aq_explicit/stxfile" > > since Zope assumes you generally want acquisition. > > --jcc > -- > "Building Websites with Plone" > http://plonebook.packtpub.com/ > > Enfold Systems, LLC > http://www.enfoldsystems.com -- John _______________________________________________ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
