Conditional programming with WebDNA
numero = 154[showif [date %A]=Friday]Today is the last day of work this week![/showif]If your server's clock is on time, and if the day is really Friday, you will see the message. Otherwise, you will see.... nothing.What if we want to see a message if today is NOT Friday? Several ways:
[showif [date %A]=Friday]Today is the last day of work this week![/showif][showif [date %A]!Friday]Too bad![/showif]Here "!" means "different from", or "is not equal to".And now we find something extremely interesting with WebDNA: you have several ways to do the same thing, because WebDNA is very flexible. You can do exactly the same thing with this code:
[showif [date %A]=Friday]Today is the last day of work this week![/showif][hideif [date %A]=Friday]Too bad![/hideif]or using an if/then style statement:
[if "[date %A]"="Friday"][then]Today is the last day of work this week![/then][else]Too bad![/else][/if]>>> Next page... Part 1 was far too easy. Now, let's see something much more complicated: we will introduce a condition.
[showif [date %A]=Friday]
Today is the last day of work this week!
[/showif]
[showif [date %A]=Friday]
Today is the last day of work this week!
[/showif]
[showif [date %A]!Friday]Too bad![/showif]
[showif [date %A]=Friday]
Today is the last day of work this week!
[/showif]
[hideif [date %A]=Friday]Too bad![/hideif]
[if "[date %A]"="Friday"]
[then]
Today is the last day of work this week!
[/then]
[else]
Too bad!
[/else]
[/if]
DOWNLOAD WEBDNA NOW!
Passing data from a form and retrieving it using WebDNA...
2. Conditional ProgrammingConditional programming with WebDNA...
7. Searching DatabasesSearching databases with WebDNA and conclusion...
WebDNACodeSparker FRAMEWORK by GovindaI am glad to help the beginners...
4. Password ProtectingHow to password-protect a page using WebDNA...
1. Learn WebDNA ProgrammingLearning WebDNA programming: the very basics...