[Zope] ZPT & contents slot
John Poltorak
jp at warpix.org
Wed Jun 22 06:23:16 EDT 2005
On Tue, Jun 21, 2005 at 04:46:55PM -0500, J Cameron Cooper wrote:
> John Poltorak wrote:
>
> > 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.
>
>
> It's the name of an object. I made up this name for your "structure text
> file, in each of the folders A B C". You may call it as you will.
>
> Note: there is no such thing as a "file" in the ZODB. Everything is an
> object.
Really?
You should try clicking on the drop down menu near the Add button of ZMI.
That allows you to create a file ;-)...
> This is how "content" is viewed. One thing I forgot to mention: you
> would apply this template (say it's named 'special_view') to your
> folders, like:
>
> http://localhost/A/special_view
> http://localhost/B/special_view
> http://localhost/C/special_view
>
> Now, if we used a template like this (let's name it 'direct_view')::
>
> <div>I'm a header</div>
>
> <p tal:replace="structure context/CookedBody">
> This is sample page content
> </p>
>
> <div>I'm a footer</div>
>
> we could apply it like so::
>
> http://localhost/A/stxfile/direct_view
> http://localhost/B/stxfile/direct_view
> http://localhost/C/stxfile/direct_view
>
> This is a much more typical pattern, at least for content. If you want
> to apply a wrapper to page templates, then you use macros.
I can't say I understood much of that, but this web page gave me an
example of exactly what I wanted to do:-
http://www.zopelabs.com/cookbook/1092772190
Here is the code snippet which looks somewhat different to that which you
suggested, or is it basically the same?
<html>
<body>
<!-- assume there is a file or other object containing structured
text, and it's called foobar. -->
<span tal:define="stx python:modules['Products'].PythonScripts.standard.structured_text;
the_text here/foobar"
tal:content="structure python:stx(the_text)">
The structured text goes here.
</span>
</body>
</html>
The problem is finding such examples, but at least in this instance I've
learnt something, so thanks for the help.
> --jcc
> --
> "Building Websites with Plone"
> http://plonebook.packtpub.com/
>
> Enfold Systems, LLC
> http://www.enfoldsystems.com
--
John
More information about the Zope
mailing list