PHP Classes

File: templates/example.html

Recommend this page to a friend!
  Classes of Alexey Burkov   Dextep Template Engine   templates/example.html   Download  
File: templates/example.html
Role: Auxiliary data
Content type: text/plain
Description: Template
Class: Dextep Template Engine
Template engine based on regular expressions
Author: By
Last change:
Date: 13 years ago
Size: 2,449 bytes


Class file image Download
<!DOCTYPE html> <html lang="en"> <head> <title>Dextep Example</title> <meta charset="utf-8" /> <style type="text/css"> table{border:1px dotted #999} td,th{text-align:center;padding:.4em .8em;} th{background:#999;color:#fff;} .weekend{background:#ff9999;} .block{border:1px solid #999;background:#ccc;width:20em;padding:1em;} .block .block{background:#009900;width:auto;margin-top:1em} </style> </head> <body> <h1>Dextep Examples</h1> <p>Here are some examples showing how Dextep statements are working. Look at <code>example.php</code> and <code>templates/example.html</code> for understanding.</p> <!------------ {if} --------------> <h3><code>{if}</code></h3> <p>This example shows how <code>{if}</code> statement works. If you'll enter your name and press "Go" then following form will be replaced with another message. Try it:</p> {if !$name} Enter your name, please. <form action="example.php" method="post"> <input name="name" value="" size="51" /><button type="submit">Go</button><br /> <label><input type="radio" name="sex" value="1" /> Male</label> <label><input type="radio" name="sex" value="2" /> Female</label> </form> {else} Hello,{if $sex == 1} Mr.{elseif $sex == 2} Mrs.{/if} {$name}. {/if} <!---------- {foreach} -----------> <h3><code>{foreach}</code></h3> <p>This example outputs multidimensional array passed from script.</p> <ol> {foreach $list as %key => %value} <li><strong>{%key}:</strong><ul> {foreach %value as %item} <li>{%item}</li> {/foreach} </ul></li> {/foreach} </ol> <!------------ {for} -------------> <h3><code>{for}</code></h3> <p>This example outputs calendar for current month using <code>{for}</code> statement.</p> <table> <thead><tr><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th></tr></thead> <tbody> <tr> {@%weekday=1} {for var=%past from=2 to=$calendar.start step=1} <td></td>{@%weekday++} {/for} {for var=%day from=1 to=$calendar.nDays step=1} {if %weekday>7}</tr><tr>{@%weekday=1}{/if} <td{if %weekday>5} class="weekend"{/if}>{%day}</td> {@%weekday++} {/for} {for var=%weekday from=%weekday to=7 step=1} <td{if %weekday>5} class="weekend"{/if}></td> {/for} </tr> </tbody> </table> <!---------- {include} -----------> <h3><code>{include}</code></h3> <p>This example shows includes in action.</p> {include subfolder/example} </body> </html>