Example #1
0
 protected function getTagRepository()
 {
     $repository = new ChariotTagRepository();
     $repository->set('exists', new ChariotExistsTagHandler());
     $repository->set('foreach', new ChariotForeachTagHandler());
     $repository->set('context', new ChariotContextTagHandler());
     return $repository;
 }
Example #2
0
                break;
            }
        }
        return $variable;
    }
}
$start = microtime(true);
$tpl = file_get_contents('foreach.tpl');
$tpl = file_get_contents('foreach_index.tpl');
$tpl = file_get_contents('foreach_dummy.tpl');
$tpl = file_get_contents('exists.tpl');
$tpl = mb_convert_encoding($tpl, 'HTML-ENTITIES', 'auto');
$document = new DOMDocument();
$document->validateOnParse = false;
$document->preserveWhiteSpace = false;
$document->loadXML($tpl);
$repository = new ChariotTagRepository();
$repository->set('exists', new ChariotExistsTagHandler());
$repository->set('foreach', new ChariotForeachTagHandler());
$repository->set('symfony', new ChariotSymfonyTagHandler());
$repository->set('context', new ChariotContextTagHandler());
$context = new ChariotContext();
$context->setGlobalAttibute('document', $document);
$context->setAttribute('Hoge', array(array('name' => 'hello', 'entry' => 'world'), array('name' => 'hello2', 'entry' => 'world2')));
$context->setAttribute('Foo', array('aaa' => array('name' => 'foo_name_1', 'value' => 'foo_value_1'), 'bbb' => array('name' => 'foo_name_2', 'value' => 'foo_value_2'), 'ccc' => array('name' => 'foo_name_3', 'value' => 'foo_value_3'), '1' => array('name' => 'foo_name_4', 'value' => 'foo_value_4'), '2' => array('name' => 'foo_name_5', 'value' => 'foo_value_5'), '3' => array('name' => 'foo_name_6', 'value' => 'foo_value_6')));
$context->setAttribute('Bar', array('value' => 'bar_value'));
$context->setAttribute('Baz', array(1, 2, 3, 4, 5, 6, 7));
$root = new ChariotRootTagHandler();
$root->start($context, $repository);
var_dump($document->saveHTML());
echo 'elapsed time: ', microtime(true) - $start, ' ms', PHP_EOL;