one in one test

From: Date: Fri, 09 Jun 2006 19:20:34 +0000
Subject: one in one test
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13462@lists.php.net to get a copy of this message
bonsoir, I wanted some one in one test. As talking in irc with pete morgan, he asked me to post it here. It's just requiring the include path: # pwd /blah/www/public_html/smarty/test # cat .htaccess php_value include_path /blah/www/smarty/cvs/smarty:/blah/www/public_html/smarty/test # cat index.php <?php ini_set('display_errors', true); error_reporting(E_ALL); $tpl_source = '<h1>{$title}</h1> <h2>{assign var="moo" value="$a.b.c.d"} {$moo}</h2> {$s|substr:0:10} <br /> {$s|string_format:"%.10s"} '; $title = 'Smarty tests'; $a = array('b.c.d' => 'booh'); $s = '123456789abcdef0'; function here_get_template ($tpl_name, &$tpl_source, &$smarty_obj) {
    $tpl_source = $GLOBALS['tpl_source'];
    return true;
} function here_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj) {
    $tpl_timestamp = time();
    return true;
} function here_get_secure($tpl_name, &$smarty_obj) {
    return true;
} function here_get_trusted($tpl_name, &$smarty_obj) { } require_once 'libs/Smarty.class.php'; $smarty = new Smarty(); // register the resource name 'here' $smarty->register_resource('here', array('here_get_template',
                                         'here_get_timestamp',
                                         'here_get_secure',
                                         'here_get_trusted'));
$vars = ''; foreach (array('title', 'a', 's') as $name) {
    $smarty->assign($name, $$name);
    $vars .= '<br />' . $name . ' = ' . htmlspecialchars(print_r($$name, true));}
$smarty->display('here:blah'); die(
    '<hr />it was: <br />' .
    htmlspecialchars($tpl_source) .
    '<br /> with: <br />' .
    $vars
); ?> Regards -- toggg

« previous php.smarty.general (#13462) next »