Dextep Examples

Here are some examples showing how Dextep statements are working. Look at example.php and templates/example.html for understanding.

{if}

This example shows how {if} statement works. If you'll enter your name and press "Go" then following form will be replaced with another message. Try it:

{if !$name} Enter your name, please.

{else} Hello,{if $sex == 1} Mr.{elseif $sex == 2} Mrs.{/if} {$name}. {/if}

{foreach}

This example outputs multidimensional array passed from script.

    {foreach $list as %key => %value}
  1. {%key}:
  2. {/foreach}

{for}

This example outputs calendar for current month using {for} statement.

{@%weekday=1} {for var=%past from=2 to=$calendar.start step=1} {@%weekday++} {/for} {for var=%day from=1 to=$calendar.nDays step=1} {if %weekday>7}{@%weekday=1}{/if} 5} class="weekend"{/if}>{%day} {@%weekday++} {/for} {for var=%weekday from=%weekday to=7 step=1} 5} class="weekend"{/if}> {/for}
MonTueWedThuFriSatSun

{include}

This example shows includes in action.

{include subfolder/example}