[Zope] newbie DTML namespace

Dieter Maurer dieter@handshake.de
Thu, 27 Jul 2000 23:09:55 +0200 (CEST)


Brad Moulton writes:
 > I would like to build a table depending on some tests peformed on stuff
 > returned form a Z SQL method
 > 
 > 1. I have a form with a name="spam" value="egs"
 > this value is passed onto next dtml document
 > ---------------------------------
 > table
 > <tr>
 > <td><dtml-var spam> <td>		// displays 'eggs'  to test spam is OK
 > </tr>
 > <dtml-var sqlstuff>			// this does a join of two tables 
 > <dtml-in sqlstuff>
 > <dtml-if {CAN'T WORK OUT SYNTAX TO ACCESS  spam to compare with lets say
 > sqlstuff.spam}
 > <tr><td><dtml-var sqlstuff.column></td>....etc
 > </dtml-if>
 > </dtml-in>  
 > ----------------------------------------------
Your problem is solved by renaming.

You can either rename your DTML var or your SQL column result name:

DTML var:

  <dtml-let myspam=spam> <!-- you can now access "spam" as "myspam"-->
    <dtml-in sqlstuff>
       ....
       <dtml-if "myspam == spam">....</dtml-if>
       ....
    </dtml-in>
  </dtml-let>

SQL column result name:

  select spam as sqlspam ...

You now access the "spam" column under the name "sqlspam".


I, regularly, use SQL column renaming.


Dieter