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: 7 years ago
Size: 2,449 bytes


Class file image Download
<!DOCTYPE html>
<html lang="en">
<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;}
.block{border:1px solid #999;background:#ccc;width:20em;padding:1em;}
.block .block{background:#009900;width:auto;margin-top:1em}
<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} -------------->

<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>
	Hello,{if $sex == 1} Mr.{elseif $sex == 2} Mrs.{/if} {$name}.

<!---------- {foreach} ----------->

<p>This example outputs multidimensional array passed from script.</p>
{foreach $list as %key => %value}
	{foreach %value as %item}


<!------------ {for} ------------->

<p>This example outputs calendar for current month using <code>{for}</code> statement.</p>
	{for var=%past from=2 to=$calendar.start step=1}
	{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>
	{for var=%weekday from=%weekday to=7 step=1}
		<td{if %weekday>5} class="weekend"{/if}></td>

<!---------- {include} ----------->

<p>This example shows includes in action.</p>
{include subfolder/example}