[Zope] How to call functions in DTML?

Chris Beaven Chris@d-designz.co.nz
Fri, 9 Aug 2002 16:45:07 +1200


Using this documentation :)
http://www.python.org/doc/current/lib/module-random.html
Write a simple python script to pick the random number. Return it as a
string.

<dtml-var "_[your_python_script()]">

the key point is the use of _['an_object_id']


To call python functions from within a document:
<dtml-var expr="python_script(attr1, attr2, ...)">

-----Original Message-----
From: Patrick Price [mailto:jprice22@wvu.edu]
Sent: Friday, 9 August 2002 4:27 p.m.
To: zope@zope.org
Subject: [Zope] How to call functions in DTML?


Simple question from a stupid newbie.

I'm used to writing inline code using PHP and I just want a random 
number to appear on a web page.  
Once I clear that hurdle,  I want to use that number to reference 
different images (objects, right).  
Then I'll have a web page that displays random images from my image library.

How do I call Python functions from within a web (aka DTML Document?) 
page in Zope?

If you tell me to read the documentation I'll strangle you. :-)  It's 
lacking.

Thanks in advance,

-Patrick Price


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )