PHP Classes

File: demo/index.php

Recommend this page to a friend!
  Classes of David N. Q. Duong   XIRE   demo/index.php   Download  
File: demo/index.php
Role: Example script
Content type: text/plain
Description: Demo Script
Class: XIRE
Template engine extensible with plug-in classes
Author: By
Last change: Comment clarifications
Date: 18 years ago
Size: 1,669 bytes
 

Contents

Class file image Download
<?php
/***
 * XIRE - eXtendable Information Rendering Engine
 * ----------------------------------------------
 * LICENSE
 * Copyright (C) 2006 David Duong
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */
// Include the Template class
require_once '../lib/Template.class.php';

// Instantiate a template object
$template = new XIRE_Template('index.tpl');

// Variables are usually 'pushed' onto the template by the programmer, but a plugin can also
// 'pull' data to a template
$template->set('variable', 'test variable');
$template->set('true', true);
// You could also pretend that $template is an array
$template['var'] = array('x', 'y', 'z');
$template['false'] = false;

// Process the template
$template->process();

// Send XML to browser
header('content-type: text/xml');
echo
$template->getXML(true); // You could also save the results into a file with
                              // $template->save('filename')
?>