- Added substr extension
[haanga.git] / examples / index.php
blobb4a9d9fc8946e7c69dd48b3696275d89b137771a
1 <?php
3 require "../lib/Haanga.php";
4 $config = array(
5 'cache_dir' => 'tmp/',
6 'template_dir' => 'complex/',
7 );
9 if (is_callable('xcache_isset')) {
10 /* don't check for changes in the template for the next 5 min */
11 $config['check_ttl'] = 300;
12 $config['check_get'] = 'xcache_get';
13 $config['check_set'] = 'xcache_set';
16 Haanga::Configure($config);
18 $people = array(
19 array('first_name' => 'George </br>', 'last_name' => 'Bush', 'gender' => 'Male', 'foobar' => 'extra'),
20 array('first_name' => 'Bill', 'last_name' => 'Clinton', 'gender' => 'Male'),
21 array('first_name' => 'Margaret', 'last_name' => 'Thatcher', 'gender' => 'Female'),
22 array('first_name' => 'Condoleezza', 'last_name' => 'Rice', 'gender' => 'Female'),
23 array('first_name' => 'Pat', 'last_name' => 'Smith', 'gender' => 'Unknown', 'bar' => 'foo'),
24 array('first_name' => '"Cesar', 'last_name' => 'Rodas"', 'gender' => 'Male'),
27 $vars = array(
28 'some_list' => array(1, 2, 3, 4, 4, 4, 5),
29 'user' => 'crodas',
30 'base_template' => 'subtemplate.html',
31 'people' => $people,
32 'days' => array(
33 strtotime("01/27/2010"),
34 strtotime("01/28/2010"),
35 strtotime("02/22/2010"),
36 strtotime("02/28/2010"),
37 strtotime("08/25/2010"),
38 strtotime("08/30/2010"),
40 'templates' => array('base' => 'index-test.html'),
44 $time = microtime(TRUE);
45 $mem = memory_get_usage();
46 Haanga::load('index.html', $vars);
47 var_dump(array('memory' => (memory_get_usage()-$mem)/(1024*1024), 'seconds' => microtime(TRUE)-$time));