From mail@peterbe.com Wed Aug 1 13:38:50 2001 From: mail@peterbe.com (Peter Bengtsson) Date: Wed, 1 Aug 2001 14:38:50 +0200 Subject: [ZPT] suggestion: content and/or silent repeat References: <001701c11936$bba0f1e0$aa6d1c3f@workstation> Message-ID: <012f01c11a86$ecd89000$1c64a8c0@PBN> >
# | Id | Meta-Type | Title | >
---|---|---|---|
# | >Id | >Meta-Type | >Title | >
# | >Id | >Meta-Type | >Title | >
>
Quote | [/pretty stuff]
Quote |
tal:content="python:whrandom.choice(root.Quotes.objectValues())">Q > uote | >
content title or id optional template idThis is Page Template template id. |
|
![]() | =20
???
''') >>> print pt(x=1)11
>>> Cheers, Evan @ 4-am & Zope From evan@zope.com Wed Aug 15 22:28:12 2001 From: evan@zope.com (Evan Simpson) Date: Wed, 15 Aug 2001 17:28:12 -0400 Subject: [ZPT] table loop References: <027d01c125b9$485ff430$0901a8c0@intranet.madisoncomunicacao.com.br> Message-ID: <3B7AE96C.9090506@zope.com> Georges J Baladi Jr wrote: > a folder with 19 images > > a page template that display the images inside a table. I want to put > 5 images in a row. You can't make partial tags with TAL statements, but you can do what you want in a totally different way: ## Script (Python) "getGroupsOfN" ##parameters=seq, at_a_time ## from ZTUtils import Batch b = Batch(seq, at_a_time, orphan=0) batches = [b] while b.next: b = b.next batches.append(b) return batches # End Script
![]() |
???
''') >>> print pt(x=1)11
------=_NextPart_000_0001_01C12718.E7AB0DD0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printableThis
didn’t work for me. =
I put
TAL, ZTUtils, and PageTemplates
(current versions from http://www.zope.org/Members/=
4am/ZPT)
on the path of my standalone Python 2.1 installation and extracted ExtensionClass from Zope and put
that on the path as well. =
When
I try the example below, I get an import error indicating that =
Acquisition is
also needed, after which ComputedAttribute =
is needed
etc.
Thanks
for ideas.
>
is it possible to use ZPT without Zope in =
Python
program?
It
is possible to use PageTemplates without =
Zope, not ZPT (short for =
Zope Page Templates). With ExtensionClass,
TAL, ZTUtils, and =
PageTemplates on
your Python path, you should be able to:
>>>
from PageTemplates.PageTemplate
import PageTemplate
>>>
pt =3D PageTemplate()
>>> pt.write('''<p =
tal:define=3D"x =
options/x"
... &nbs=
p;
tal:content=3D"python:x+1">???&l=
t;/p>''')
>>> print
pt(x=3D1)
<p>11</p>