Exemplo n.º 1
0
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license,      |
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Wolfram Kriesing <*****@*****.**>                      |
// +----------------------------------------------------------------------+
//  $Id: index.php,v 1.1 2003/02/10 22:18:46 cain Exp $
//ini_set('include_path',realpath(dirname(__FILE__).'/../../../../../').':'.realpath(dirname(__FILE__).'/../../../../../../includes').':'.ini_get('include_path'));
//ini_set('error_reporting',E_ALL);
//
//   include the files needed
//
require_once 'HTML/Template/Xipe.php';
require_once 'HTML/Template/Xipe/Filter/Basic.php';
//
//   make template class instance
//
$options = array('templateDir' => dirname(__FILE__), 'compileDir' => 'tmp', 'autoBraces' => false);
$tpl = new HTML_Template_Xipe($options);
// fill some vars
$nums = array('one', 'two', 'three');
//
//   show the template
//
$tpl->compile('index.tpl');
include $tpl->getCompiledTemplate();
Exemplo n.º 2
0
//  $Id: index.php,v 1.2 2003/01/30 17:43:42 cain Exp $
//
//ini_set('include_path',realpath(dirname(__FILE__).'/../../../').':'.realpath(dirname(__FILE__).'/../../../../includes').':'.ini_get('include_path'));
//ini_set('error_reporting',E_ALL);
##################################################
#
#       init template engine
#
// you need the template class from http://sf.net/projects/simpltpl
if (!@(include 'HTML/Template/Xipe.php')) {
    print 'sorry, you need the template class PEAR::HTML_Template_Xipe<br>' . 'or if i have time i put the examples <a href="http://os.visionp.de/">here online</a>';
    die;
}
require_once 'HTML/Template/Xipe/Filter/TagLib.php';
$options = array('templateDir' => dirname(__FILE__));
$tpl = new HTML_Template_Xipe($options);
require_once 'HTML/Template/Xipe/Filter/Modifier.php';
$modifiers = new HTML_Template_Xipe_Filter_Modifier($tpl->options);
$tpl->registerPrefilter(array(&$modifiers, 'imgSrc'), array(dirname(__FILE__), 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])));
// session stuff to save the opened folders etc.
session_start();
if (!session_is_registered('session')) {
    $session = new stdClass();
    // standard PHP-class constructor
    session_register('session');
    $session->data = array();
    $session->use = 'Filesystem';
} else {
    $session =& $_SESSION['session'];
}
// set the source to use
Exemplo n.º 3
0
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Wolfram Kriesing <*****@*****.**>                      |
// +----------------------------------------------------------------------+
//  $Id: index.php,v 1.1 2003/02/10 22:18:46 cain Exp $
//
//   include the files needed
//
//ini_set('include_path',realpath(dirname(__FILE__).'/../../../../../').':'.realpath(dirname(__FILE__).'/../../../../../../includes').':'.ini_get('include_path'));
//ini_set('error_reporting',E_ALL);
require_once 'HTML/Template/Xipe.php';
//
//   make template class instance
//
$options = array('templateDir' => dirname(__FILE__), 'compileDir' => 'tmp', 'enable-Cache' => true, 'logLevel' => 1);
$tpl = new HTML_Template_Xipe($options);
$tplFile = 'index.tpl';
// if the final output is not cached do the heavy work here
if (!$tpl->isCached($tplFile)) {
    print 'CACHE MISS, GENERATING CACHE FILE NOW!';
}
$tpl->compile($tplFile);
// call this method also if cached, to generate the property used in getCompiledTemplate()
// if the file is cached no compilation is done
include $tpl->getCompiledTemplate();
// include the (cached) file
Exemplo n.º 4
0
//  $Id: index.php,v 1.3 2003/02/25 12:14:30 cain Exp $
//
ini_set('include_path', realpath(dirname(__FILE__) . '/../../../') . ':' . realpath(dirname(__FILE__) . '/../../../../includes') . ':' . ini_get('include_path'));
ini_set('error_reporting', E_ALL);
##################################################
#
#       init template engine
#
// you need the template class from http://sf.net/projects/simpltpl
if (!@(include 'HTML/Template/Xipe.php')) {
    print 'sorry, you need the template class PEAR::HTML_Template_Xipe<br>' . 'or if i have time i put the examples <a href="http://os.visionp.de/">here online</a>';
    die;
}
require_once 'HTML/Template/Xipe/Filter/TagLib.php';
$options = array('templateDir' => dirname(__FILE__));
$tpl = new HTML_Template_Xipe($options);
##################################################
#
#       actual tree stuff, using Dynamic_DBnested
#
require_once 'Tree/Tree.php';
$tree = Tree::setup('Dynamic_DBnested', 'mysql://root@localhost/test', array('table' => 'Tree_Nested'));
if (@$_REQUEST['action_add']) {
    $methodCall = "tree->add( {$_REQUEST['newData']} , {$_REQUEST['parentId']} , {$_REQUEST['prevId']} )";
    $result = $tree->add($_REQUEST['newData'], $_REQUEST['parentId'], $_REQUEST['prevId']);
}
if (@$_REQUEST['action_remove']) {
    $methodCall = "{$tree->remove}( {$_REQUEST['removeId']} )";
    $result = $tree->remove($_REQUEST['removeId']);
}
if (@$_REQUEST['action_update']) {
Exemplo n.º 5
0
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Wolfram Kriesing <*****@*****.**>                      |
// +----------------------------------------------------------------------+
//  $Id: index.php,v 1.1 2003/02/10 22:19:08 cain Exp $
//ini_set('include_path',realpath(dirname(__FILE__).'/../../../../../').':'.realpath(dirname(__FILE__).'/../../../../../../includes').':'.ini_get('include_path'));
//ini_set('error_reporting',E_ALL);
//
//   make template class instance
//
require_once 'HTML/Template/Xipe.php';
$options = array('templateDir' => dirname(__FILE__));
$tpl = new HTML_Template_Xipe($options);
//
//   apply translating filters to the template
//
// this is in PEAR, get the newest version from the cvs
// for more info see: http://www.php.net/anoncvs.php
// source is at: http://cvs.php.net/cvs.php/pear/I18N
require_once 'I18N/Messages/Translate.php';
require_once 'HTML/Template/Xipe/Filter/Translate.php';
$DB_DSN = 'mysql://root@localhost/test';
$translator = new I18N_Messages_Translate($DB_DSN, array('tablePrefix' => 'translate_'));
function translateAndPrint($string)
{
    global $translator, $lang;
    $translated = $translator->simpleTranslate($string, $lang);
    // only translate exact matches
Exemplo n.º 6
0
// +----------------------------------------------------------------------+
// | Authors: Wolfram Kriesing <*****@*****.**>                      |
// +----------------------------------------------------------------------+
//  $Id: index.php,v 1.1 2003/02/10 22:20:00 cain Exp $
ini_set('include_path', realpath(dirname(__FILE__) . '/../../../../../') . ':' . realpath(dirname(__FILE__) . '/../../../../../../includes') . ':' . ini_get('include_path'));
ini_set('error_reporting', E_ALL);
//
//   include the files needed
//
require_once 'HTML/Template/Xipe.php';
require_once 'HTML/Template/Xipe/Filter/Basic.php';
//
//   make template class instance
//
$options = array('templateDir' => dirname(__FILE__), 'compileDir' => 'tmp', 'verbose' => true, 'locale' => '', 'logLevel' => 1, 'filterLevel' => 0);
$tpl = new HTML_Template_Xipe($options);
//
//   make filter class instance
//   and apply filters as needed
//
$tplFilter = new HTML_Template_Xipe_Filter_Basic($tpl->getOptions());
// pre filter
$tpl->registerPrefilter(array(&$tplFilter, 'removeHtmlComments'));
$tpl->registerPrefilter(array(&$tplFilter, 'removeCStyleComments'));
$tpl->registerPrefilter(array(&$tplFilter, 'addIfBeforeForeach'));
// this filter makes the foreach-blocks conditional, so they are only shown if they contain data, see api-doc
// post filter
$tpl->registerPostfilter(array(&$tplFilter, 'trimLines'));
$tpl->registerPostfilter(array(&$tplFilter, 'optimizeHtmlCode'));
//
//   fill variables used in the template