PHP Classes

File: example_autoglobal.php

Recommend this page to a friend!
  Packages 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: 19 years ago
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();
?>