public static function compile(vB_Xml_Node $main_node, vB_TemplateParser $parser) { $var_name = array_shift($main_node->attributes); $var_value = array_shift($main_node->attributes); $argument = ""; if ($var_name instanceof vB_CurlyNode and in_array($var_name->value, array('raw', 'var'))) { $string = vB_TemplateParser_Tag::compileVar($var_name->attributes[0]); } else { $string = '$' . $var_name; } if ($var_value instanceof vB_CurlyNode and in_array($var_value->value, array('raw', 'var'))) { $value = vB_TemplateParser_Tag::compileVar($var_value->attributes[0]); } else { $value = '$' . $var_value; } return "''; {$string} = str_repeat({$string}, intval({$value}));" . ' $final_rendered .= \'\''; }
public static function compile(vB_DomNode $main_node, vB_TemplateParser $parser) { $key = ''; if (isset($main_node->attributes['key'])) { $key = parent::compileVar($main_node->attributes['key']); } $from = parent::compileVar($main_node->attributes['from']); $value = parent::compileVar($main_node->attributes['value']); $children = $parser->_parse_nodes($main_node->childNodes()); return "''" . '; if (is_array(' . $from . ') || ' . $from . ' instanceof ArrayAccess) { foreach (' . $from . ' AS ' . ($key ? $key . ' => ' : '') . $value . ') {' . $parser->outputVar . " .= '" . $children . "'; } }" . $parser->outputVar . " .= ''"; }