List.class.php (513B)
1 <?php 2 3 namespace template_engine\components; 4 5 class ListComponent extends Component 6 { 7 8 public $list; 9 10 public $extract = false; 11 12 public $key = 'list_key'; 13 14 public $value = 'list_value'; 15 16 public function begin() 17 { 18 echo '<?php foreach($' . $this->varname($this->list) . ' as $' . $this->varname($this->key) . '=>$' . $this->varname($this->value) . '){ ?>'; 19 20 if ($this->extract) 21 echo '<?php extract($' . $this->varname($this->value) . ') ?>'; 22 } 23 24 public function end() 25 { 26 echo '<?php } ?>'; 27 } 28 } 29 30 ?>