Пример #1
0
function do_league_tabs()
{
    global $globals;
    $globals['league_base_url'] = $globals['base_url'] . 'admin/league/';
    $tabs = array(_('Ligas') => 'index.php', _('Equipos') => 'teams.php', _('Partidos') => 'matches.php');
    $links = array();
    $self = basename($_SERVER["SCRIPT_NAME"]);
    foreach ($tabs as $tab => $page) {
        $links[] = array('url' => $globals['league_base_url'] . $page, 'name' => $tab, 'active' => $page == $self);
    }
    Haanga::load('league/list.tpl', compact('links'));
}
Пример #2
0
 /**
  * Render Haanga Template
  *
  * This method will output the rendered template content
  *
  * @param   string $template The path to the Haanga template, relative to the Haanga templates directory.
  * @return  string|NULL
  */
 public function render($template)
 {
     return Haanga::load($template, $this->data);
 }
Пример #3
0
<?php

require "../lib/Haanga.php";
#apd_set_pprof_trace('/tmp/apd/');
$config = array('cache_dir' => 'tmp/', 'template_dir' => 'complex/');
if (is_callable('xcache_isset')) {
    /* don't check for changes in the template for the next 5 min */
    $config['check_ttl'] = 300;
    $config['check_get'] = 'xcache_get';
    $config['check_set'] = 'xcache_set';
}
Haanga::Configure($config);
$people = array(array('first_name' => 'George </br>', 'last_name' => 'Bush', 'gender' => 'Male', 'foobar' => 'extra'), array('first_name' => 'Bill', 'last_name' => 'Clinton', 'gender' => 'Male'), array('first_name' => 'Margaret', 'last_name' => 'Thatcher', 'gender' => 'Female'), array('first_name' => 'Condoleezza', 'last_name' => 'Rice', 'gender' => 'Female'), array('first_name' => 'Pat', 'last_name' => 'Smith', 'gender' => 'Unknown', 'bar' => 'foo'), array('first_name' => '"Cesar', 'last_name' => 'Rodas"', 'gender' => 'Male'));
$vars = array('some_list' => array(1, 2, 3, 4, 4, 4, 5), 'user' => 'crodas', 'base_template' => 'subtemplate.html', 'people' => $people, 'days' => array(strtotime("01/27/2010"), strtotime("01/28/2010"), strtotime("02/22/2010"), strtotime("02/28/2010"), strtotime("08/25/2010"), strtotime("08/30/2010")), 'templates' => array('base' => 'index-test.html'));
$time = microtime(TRUE);
$mem = memory_get_usage();
Haanga::load('index.html', $vars);
var_dump(array('memory' => (memory_get_usage() - $mem) / (1024 * 1024), 'seconds' => microtime(TRUE) - $time));