Login   Register  
PHP Classes
elePHPant
Icontem

File: example_autoglobal.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kalle Sommer Nielsen  >  Template Processor  >  example_autoglobal.php  >  Download  
File: example_autoglobal.php
Role: Example script
Content type: text/plain
Description: Example file - Using autoglobals
Class: Template Processor
Template processing engine
Author: By
Last change: Updated to match the latest class version
Date: 2007-01-17 11:37
Size: 542 bytes
 

Contents

Class file image Download
<?php
    
/**
     * Load class
     */
    
require_once("./template.class.php");

    
/**
     * Make object instance and enable the 'autoglobal' and 
     * 'allowphp' option
     */
    
$temp = new Template(Array('allowphp' => true'autoglobal' => true));

    
/**
     * Define some variables outside the template
     */
    
$variable 'Hello World';

    
/**
     * Add a custom piece of code, that will show the value 
     * of our variable when compiling
     */
    
$temp->addcache("<?php echo(\$variable); ?>");

    
/**
     * Compile
     */
    
$temp->compile();
?>