Хранилища Subversion ant

Редакция

Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
/**
3
* Smarty Internal Plugin Compile While
4
*
5
* Compiles the {while} tag
6
*
7
* @package Smarty
8
* @subpackage Compiler
9
* @author Uwe Tews
10
*/
11
/**
12
* Smarty Internal Plugin Compile While Class
13
*/
14
class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
15
    /**
16
    * Compiles code for the {while} tag
17
    *
18
    * @param array $args array with attributes from parser
19
    * @param object $compiler compiler object
20
    * @return string compiled code
21
    */
22
    public function compile($args, $compiler)
23
    {
24
        $this->compiler = $compiler;
25
        $this->required_attributes = array('if condition');
26
        // check and get attributes
27
        $_attr = $this->_get_attributes($args);
28
        $this->_open_tag('while');
29
        if (is_array($args['if condition'])) {
30
            $_output = " <?php if (!isset(\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."])) \$_smarty_tpl->tpl_vars[".$args['if condition']['var']."] = new Smarty_Variable;\n";
31
            $_output .= " while (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value'].") {\n ?>";
32
            return $_output;
33
        } else {
34
            return '<?php while (' . $args['if condition'] . ') { ?>';
35
        }
36
    }
37
}
38
 
39
?>