/**
* Processes a view script and returns the output.
*
* @param string $name The script name to process.
* @return string The script output.
*/
public function render($name)
{
// find the script file name using the parent private method
$this->_file = $this->_script($name);
unset($name); // remove $name from local scope
ob_start();
$this->_run($this->_file);
return $this->_filter(ob_get_clean()); // filter output
}
{{BLOCK aaaa}}
{{BLOCK bbbb}}
{{END}}
{{END}}
?обратиться к шаблонизатору
выполнитьАвтор оригинала: HraKK
что такое ?
echo $this->fetch("/aaaa/bbbb/", array(данные для заполнения));
ну и код же генерят в зенде, показал как убрать $nameАвтор оригинала: nerezus
PHP:/** * Processes a view script and returns the output. * * @param string $name The script name to process. * @return string The script output. */ public function render() { // find the script file name using the parent private method $this->_file = $this->_script(func_get_arg(0)); ob_start(); $this->_run($this->_file); return $this->_filter(ob_get_clean()); // filter output }
class _Template_6987698769 {
private $vars = array(),
$context_stack = array( array('/' => $this->vars) );
private $blocks_map = array(
'/' => 'block1',
'/A' => 'block2',
'/A/B' => 'block3',
'/C' => 'block4',
);
protected function block1() {
return 'texttext' . $this->getContextVar('var_name')
. $this->iterate('A') . $this->iterate('C') ....
}
protected function iterate($block) {
$this->pushContext($block);
$this->{$this->blocks_map[$block]}();
$this->popContext();
}
public function fetch($item = '/') {
return $this->iterate($item);
}
}
почему?решать проблему двумя шаблонами некомильфо
почему?Автор оригинала: HraKK
Показал как не надо делать, молодец.
для ajax ответов, когда, например, в div вставляется часть шаблонаАвтор оригинала: Lightning
Жесть.
Зачем это нужно?
Не будет.решать проблему двумя шаблонами некомильфо, хочется решения пооптимальнее ибо реализовавать этот вариант для трех-четырех и более вложений будет сущим испытанием