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]
[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!
...
3. Passing Data from a FormPassing data from a form and retrieving it using WebDNA...
IntroductionA short introduction to WebDNA programming for absolute beginner...
7. Searching DatabasesSearching databases with WebDNA and conclusion...
2. Conditional ProgrammingConditional programming with WebDNA...
5. Writing FilesHow to write a file using WebDNA...