PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Rick Hopkins  >  plato  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: example php index file
Class: plato
Template parsing engine
Author: By
Last change: Includes code for assigning filenames to variables for the plato_include method.
index.php
-----------
$pl->assign("header", "header.tpl");

index.tpl
-----------
{plato_include=header&type=tpl&ref=1}

ref=1 relates the plato_include=header to the header variable created in index.php

Also include code for setting a dynamic value to the _stateSel function call.
index.php
-----------
$pl->assign("state", array("selected" => "MI", "class" => "input"));

index.tpl
-----------
{plato_func=_stateSel&var=state&ref=1}

ref=1 relates the var=state to the state variable you created in index.php
Date: 18 years ago
Size: 1,151 bytes
 

Contents

Class file image Download
<?php
   
require("lib/plato.inc");
   
   
// start up plato class
   
$pl = new plato();
   
   
// assign all variables
   
$pl->assign("header", "header.tpl");
   
$pl->assign("argVal", "Rick Hopkins<br>Web Developer<br>Morrison Industrial Equipment<br>Grand Rapids, Michigan");
   
$pl->assign("name", array("John Smith", "Mary Smith", "John Smith Jr."));
   
$pl->assign("age", array("25", "23", "3"));
   
$pl->assign("position", array("Dad", "Mom", "Son"));
   
$pl->assign("title", "Plato Template System Test Run");
   
$pl->assign("test1", "This is a test of the Plato Template System.");
   
$pl->assign("test2", "This template system can load files as includes, set variables, and perform functions.<br>The code is easily extendable and users can write their own functions to work as Plato plugins.");
   
$pl->assign("footerTest", "This is the footer section of the page.<br>It was pulled into the page by a plato include command.");
   
   
$pl->assign("state", array("selected" => "MI", "class" => "input"));
   
   
// create the page
   
$pl->display("index.tpl");
   
   
// do a speed check
   
print("<br><h1><b>File Parse Time:</b><hr>".$pl->getParseTime()."</h1>");
?>

For more information send a message to info at phpclasses dot org.