[Zope3-checkins] CVS: Zope3/src/zope/pagetemplate - readme.txt:1.3
Fred L. Drake, Jr.
fred at zope.com
Fri Mar 26 15:12:10 EST 2004
Update of /cvs-repository/Zope3/src/zope/pagetemplate
In directory cvs.zope.org:/tmp/cvs-serv12049
Modified Files:
readme.txt
Log Message:
update some package names
=== Zope3/src/zope/pagetemplate/readme.txt 1.2 => 1.3 ===
--- Zope3/src/zope/pagetemplate/readme.txt:1.2 Wed Dec 25 09:15:13 2002
+++ Zope3/src/zope/pagetemplate/readme.txt Fri Mar 26 15:12:09 2004
@@ -3,22 +3,22 @@
Introduction
Page Templates provide an elegant templating mechanism that
- achieves a clean separation of presentation and application
+ achieves a clean separation of presentation and application
logic while allowing for designers to work with templates
in their visual editing tools (FrontPage, Dreamweaver, GoLive,
- etc.)
+ etc.).
This document focuses on usage of Page Templates outside of
a Zope context, it does *not* explain how to write page templates
as there are several resources on the web which do so.
Dependencies
-
+
Zope3 Package Dependencies
- - TAL (Template Attribute Language)
+ - zope.tal (Template Attribute Language)
- - Interface
+ - zope.talInterface
- ZTUtils (batching utilities for zpt)
@@ -28,18 +28,17 @@
Using PageTemplates outside of Zope3 is very easy and straight
forward. a quick example::
-
- > python
- >> from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
- >> my_pt = PageTemplateFile('hello_world.pt')
- >> my_pt()
- u'<html><body>Hello World</body></html>'
+
+ >>> from zope.pagetemplate.pagetemplatefile import PageTemplateFile
+ >>> my_pt = PageTemplateFile('hello_world.pt')
+ >>> my_pt()
+ u'<html><body>Hello World</body></html>'
Setting Up Contexts
-
+
Rendering a page template without binding data to is not very
interesting. By default keyword arguments you pass in page
- templates appear in the options namespace.
+ templates appear in the options namespace.
pt_getContext(**keywords)
Should ignore keyword arguments that it doesn't care about,
@@ -52,16 +51,14 @@
namespace argument is a mapping which defines the top-level
namespaces passed to the TALES expression engine.
- Narrative ()
-
Narrative (Subclassing PageTemplates)
Lets say we want to alter page templates such that keyword
- arguments appear as top level items in the namespace. we can
- subclass page template and alter the default behavior of
+ arguments appear as top level items in the namespace. we can
+ subclass page template and alter the default behavior of
pt_getContext to add them in::
-
- from Zope.PageTemplate.PageTemplate import PageTemplate
+
+ from zope.pagetemplate.pagetemplate import PageTemplate
class mypt(PageTemplate):
def pt_getContext(self, args=(), options={}, **kw):
@@ -75,7 +72,7 @@
So now we can bind objects in a more arbitrary fashion, like
the following::
- template = """
+ template = """
<html>
<body>
<b tal:replace="das_object/getContents">Good Stuff Here</b>
More information about the Zope3-Checkins
mailing list