Sluz v0.9.4 documentation

Available documentation:

001_basic_vars.php

PHP:
<?php

///////////////////////////////////////////////////////////////////////////////
// Basic syntax for assigning variables to the templating system. You can    //
// assign scalars, arrays, and hashes.                                       //
///////////////////////////////////////////////////////////////////////////////

include("../sluz.class.php");
$s = new sluz();

$s->assign("first", "Jason"); // Scalar syntax
$s->assign("last" , "Doolis");

$s->assign("month", ["Jan", "Feb", "Mar"]); // Array syntax
$s->assign("data" , ["color" => "red"]);    // Hash syntax

print $s->fetch("tpls/001_basic_vars.stpl");
Template:
<h1>Welcome</h1>

<p>Hello {$first} {$last}</p>

<p>The first month of the year is {$month.0}</p>

<p>My favorite color is {$data.color}</p>