PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of bonvga  >  SmartyX  >  demo.php  >  Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: demo menu
Class: SmartyX
Extend Smarty to use ModeliXe notation
Author: By
Last change:
Date: 17 years ago
Size: 2,699 bytes
 

Contents

Class file image Download
<?php
   
// switch smarty_dir by environment
   
$environment = "wwwdev.bonvga.net";
    switch(
$environment)
    {
        case
"dev.bonvga.net":
           
define ("SMARTY_DIR" ,"/home/www/dev/smartyx/smarty/");
            break;
        case
"www.bonvga.net":
           
define ("SMARTY_DIR" ,"/home/www/dev/smartyx/smarty/");
            break;
        case
"wengo.fr":
           
define ("SMARTY_DIR" ,CLASSES_PATH."/Render/Smarty/");
            break;
        default:
        
define ("SMARTY_DIR" ,dirname($_SERVER["PATH_TRANSLATED"])."/smarty/");
         break;
    }
   
define("SMARTY_EDGE_VIEWER_OVERLIB_PATH" ,"overlib/overlib.js");

   
    include(
SMARTY_DIR."SmartyX.class.php");

   
// get the temporary path to store smarty data (compiled and cached templates)
   
$temp_dir = "/tmp/";
    if (isset(
$_ENV["TEMP"]))
    {
      
$temp_dir = $_ENV["TEMP"];
    }
   
   
// smarty initialization
   
$smartyx = new Render_Smarty_SmartyX();
   
$smartyx->compile_dir = $temp_dir;
   
$smartyx->cache_dir = $temp_dir;
   
$smartyx->template_dir = "templates/";
   
$smartyx->debug_tpl = SMARTY_DIR."debug_smartyx.tpl";
   
$smartyx->debugging = false;
   
$smartyx->compile_check = true;
   
$smartyx->cache_modified_check = false;
   
$smartyx->debugging = false;
   
$smartyx->caching = 0;
   
$smartyx->force_compile = false;

   
// dedicate to demo
   
if (isset($_GET["id"]))
    {
        if (isset(
$_GET["debug"]))
        {
           
$smartyx->debugging = true;
        }
        if (isset(
$_GET["edge"]))
        {
         
define("SMARTY_EDGE_VIEWER" ,true);
        }
        else
        {
         
define("SMARTY_EDGE_VIEWER" ,false);
        }
        include(
"demo_".$_GET["id"].".php");
    }
    else
    {
        echo
"<a href=\"demo.php?id=1\">demo 1 - imbricate</a><br />";
        echo
"<a href=\"demo.php?id=1&debug=1\">demo 1 - imbricate (debug)</a><br />";
        echo
"<a href=\"demo.php?id=1&edge=1\">demo 1 - imbricate (edge viewer)</a><br />";
        echo
"<a href=\"demo.php?id=1&debug=1&edge=1\">demo 1 - imbricate (debug) (edge viewer)</a><br />";

        echo
"<hr />";
       
        echo
"<a href=\"demo.php?id=2\">demo 2 - selective caching</a><br />";
        echo
"<a href=\"demo.php?id=2&debug=1\">demo 2 - selective caching (debug)</a><br />";
        echo
"<a href=\"demo.php?id=2&edge=1\">demo 2 - selective caching (edge viewer)</a><br />";
        echo
"<a href=\"demo.php?id=2&debug=1&edge=1\">demo 2 - selective caching (debug) (edge viewer)</a><br />";

        echo
"<hr />";

        echo
"<a href=\"demo.php?id=3\">demo 3 - sort and imbricate</a><br />";
        echo
"<a href=\"demo.php?id=3&debug=1\">demo 3 - sort and imbricate (debug)</a><br />";
        echo
"<a href=\"demo.php?id=3&edge=1\">demo 3 - sort and imbricate (edge viewer)</a><br />";
        echo
"<a href=\"demo.php?id=3&debug=1&edge=1\">demo 3 - sort and imbricate (debug) (edge viewer)</a><br />";
    }
?>

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