[Zope] newbie question about DTML IF
seb bacon
seb@jamkit.com
Wed, 24 Oct 2001 13:14:30 +0100
* Myles Byrne <wisemanb@ihug.com.au> [011024 12:20]:
> I'm trying to add a statement to my page that greets each user with a
> different statement, but i can't seem to work out how to do it.
> <dtml-if expr="AUTHENTICATED_USER = bob">
> bob likes to eat fish
> </dtml-if>
Two points to note:
1) Wrong operator.
= is an assignment operator (a=3 means 'assign the
value 3 to the variable a).
you want ==, which tests equality.
2) you're comparing a string, 'bob' to a non-existent variable, bob.
when you're inside quotes, you're in python. "bob" therefore
refers to a variable by the name of bob. AUTHENTICATED_USER is a
string (in this case, 'bob'), not a variable.
You want
> <dtml-if expr="AUTHENTICATED_USER == 'bob'">
> bob likes to eat fish
> </dtml-if>
hth
seb