<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="lt" lang="lt" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=charset=iso-8859-1" />
<meta name="robots" content="noindex,nofollow">
<title><var>version</var>: sample pattern</title>
<style type="text/css">
body {
font-family: Arial;
}
h1 {
margin: 2px;
background: #DADFC5;
font-family: "Arial Narrow", "Trebuchet MS", Tahoma, Arial;
text-align: center;
}
div#container div {
float: left;
width: 33%;
}
code {
display: block;
padding: 2px;
margin-bottom: 5px;
background: #EDEFE3;
color: #800000;
}
span, code, p {
margin-right: 5px;
}
span {
font-size: small;
}
</style>
</head>
<body>
<div id="container">
<div>
<h1>VAR</h1>
<p>Example 1: <strong>User assigned variable</strong></p>
<span><em>PHP code:</em></span>
<code>phpEngine::assign("<u>var1</u>", "<em>This is a user assigned variable</em>");</code>
<span><em>Pattern code:</em></span>
<code><var><u>var1</u></var></code>
<span><em>phpEngine output:</em></span>
<code><em><var>var1</var></em></code>
<p>Example 2: <strong>Global variable <em>version</em></strong></p>
<span><em>Pattern code:</em></span>
<code><var><u>version</u></var></code>
<span><em>phpEngine output:</em></span>
<code><em><var>version</var></em></code>
</div>
<div>
<h1>INC</h1>
<p>Example 3: <strong>Including file pattern</strong></p>
<span><em>Pattern code:</em></span>
<code><inc><u>example.pat</u></inc></code>
<span><em>phpEngine output:</em></span>
<code><inc>include.pat</inc></code>
<p>Example 4: <strong>Using a shifting file name for inclusion</strong></p>
<span><em>PHP code:</em></span>
<code>phpEngine::assign("<u>include</u>", "<em>example.pat</em>");</code>
<span><em>Pattern code:</em></span>
<code><inc><u>include</u></inc></code>
<span><em>phpEngine output:</em></span>
<code><inc>include</inc></code>
</div>
<div>
<h1>LOOP</h1>
<p>Example 5: <strong>Looping data</strong></p>
<span><em>PHP code:</em></span>
<code>$data_array = array(
array("Max", "1072908000"),
array("Liz", "1076796000"),
array("Maria", "1078178400"));
phpEngine::assign("<u>loop_name</u>", $data_array, "<em>name, unix_time</em>");</code>
<p>Example 5.1: <strong>Printing the value</strong></p>
<span><em>Pattern code:</em></span>
<code><loop name="<u>loop_name</u>">{<em>name</em>} </loop></code>
<span><em>phpEngine output:</em></span>
<code><em><loop name="loop_name">{name} </loop></em></code>
<p>Example 5.2: <strong>Printing the placeholder title (key)</strong></p>
<span><em>Pattern code:</em></span>
<code><loop name="<u>loop_name</u>">{<em>name::this</em>} </loop></code>
<span><em>phpEngine output:</em></span>
<code><em><loop name="loop_name">{name::this} </loop></em></code>
<p>Example 5.3: <strong>Adding global placeholder <em>lnum</em> (line/loop number)</strong></p>
<span><em>Pattern code:</em></span>
<code><loop name="<u>loop_name</u>">{<em>lnum</em>}.{<em>name</em>} </loop></code>
<span><em>phpEngine output:</em></span>
<code><em><loop name="loop_name">{lnum}.{name} </loop></em></code>
<p>Example 5.4: <strong>Detecting unix timestamp</strong></p>
<span><em>Pattern code:</em></span>
<code><loop name="<u>loop_name</u>">{<em>unix_time</em>}; </loop></code>
<span><em>phpEngine output:</em></span>
<code><em><loop name="loop_name">{unix_time}; </loop></em></code>
</div>
</div>
</body>
</html>
|