[Zope] Dynamic ordering of DTML-IN?

Andrew Kenneth Milton akm@mail.theinternet.com.au
Tue, 23 Jan 2001 23:12:43 +1000


+-------[ Andy Gates ]----------------------
| Another one from the "my brain don't work" side of the tracks:
| 
| I have a staff list that I want to be orderable by first or last name. 
| So I have buttons for each that link thus:
| 
| <a href="staff?orderby=firstname"> etc
| 
| The idea is that that feeds over to the DTML-IN tag thus:
| 
| <dtml-in "sql_search(search='foo')" sort=orderby>
| 
| But this barfs, because it's expecting a field name "orderby" and there
| isn't one.  How do I evaluate that?

<dtml-in "sql_search(search='foo', orderby=orderby)">

Then change your Z SQL Method to look like;

select * from Customers where
foofield=<dtml-sqlvar search type=string>
<dtml-if orderby>
ORDER BY <dtml-var orderby>
</dtml-if>

-- 
Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   | Andrew Milton
The Internet (Aust) Pty Ltd          |  F:+61 7 3870 4477   | 
ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068    |akm@theinternet.com.au|