[ZPT] SQL Methods and arguments
Casey Duncan
casey@zope.com
03 Jun 2002 16:15:49 -0400
On Mon, 2002-06-03 at 14:17, Jim Kutter wrote:
> Hiya
>
> I want to have a page template that displays the fields of a db record. The row id of the record is passed to the template in a GET variable. I only want that item to be displayed (not all the records in a table, that I can do)
>
> I don't want to code the display of the item in DTML or python because I want my designers to be able to modify the page easily.
>
> How would I do this?
>
> -jim
I think the answer lies in the "Simple Direct Traversal" support in ZSQL
methods (turn it on in the advanced tab). This allows you to use a url
like:
http://myzope/sqlMethod/rowid/pageTemplate.html
Where rowid is a primary key value in the table (sqlMethod must take
only one argument). In pageTemplate.html you can then do things like:
Some Field: <span tal:replace="here/field_name">Sample Value</span>
A google search for "Direct Traversal" brought up this example by Chris
McDonough, which is in DTML, but is conceptually the same.
http://www.zope.org/Members/mcdonc/HowTos/direct_traversal
hth,
-Casey