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? ---------------------- Andy Gates, Learning and Research Technology Andy.Gates@bristol.ac.uk - ICQ#74362415 http://www.ilrt.bristol.ac.uk
You can use something like: <dtml-if "orderby=='firstname'"> <dtml-in "sql_search(search='foo')" sort=firstname> <dtml-elif "orderby=='lastname'"> <dtml-in "sql_search(search='foo')" sort=lastname> </dtml-if> On Tuesday 23 January 2001 10:39 am, you wrote:
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?
---------------------- Andy Gates, Learning and Research Technology Andy.Gates@bristol.ac.uk - ICQ#74362415 http://www.ilrt.bristol.ac.uk
_______________________________________________ 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 )
-- Diego Rodrigo Neufert Webmaster / Web Developer - Magic Web Design ----------------------------------------------------------- diego@magicwebdesign.com.br www.magicwebdesign.com.br Curitiba - PR - Brasil
Message-ID: <EXECMAIL.1010123131444.B@kosh.bris.ac.uk> Priority: NORMAL X-Mailer: Execmail for Win32 5.1 Build (9) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii"
You can use something like:
<dtml-if "orderby=='firstname'"> <dtml-in "sql_search(search='foo')" sort=firstname> <dtml-elif "orderby=='lastname'"> <dtml-in "sql_search(search='foo')" sort=lastname> </dtml-if>
Hmm, that chokes, becuase it thinks the </dtml-if> tag is inside the <dtml-in> I think. AndyG
You can use something like:
<dtml-if "orderby=='firstname'"> <dtml-in "sql_search(search='foo')" sort=firstname> <dtml-elif "orderby=='lastname'"> <dtml-in "sql_search(search='foo')" sort=lastname> </dtml-if>
For Zope.2.3.0+ you can use: <dtml-in "sql_search(search='foo')" sort_expr="orderby"> -- Adam Karpierz karpierz@alpha.pl
+-------[ 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|
participants (4)
-
Adam Karpierz -
Andrew Kenneth Milton -
Andy Gates -
Diego Rodrigo Neufert