Example #1
0
 public final function render()
 {
     $this->lf = $this->layout !== null ? get::mvc_file('layout', $this->layout) : false;
     if ($this->lf === false && $this->layout != 'default') {
         $this->lf = get::mvc_file('layout', 'default');
     }
     $this->vf = $this->view !== null ? get::mvc_file('view', $this->view) : false;
     if ($this->lf === false) {
         throw new Exception('Unable to find layout: ' . $this->layout);
     }
     if ($this->vf === false) {
         throw new Exception('Unable to find view: ' . $this->view);
     }
     if (isset($this->params) && is_array($this->params) && is::assoc_array($this->params)) {
         extract($this->params);
     }
     $this->helpers = get::helpers('template');
     extract($this->helpers);
     ob_start();
     require $this->vf;
     $munla_view_data = ob_get_contents();
     ob_end_clean();
     if (!isset($page_title)) {
         $page_title = config::TITLE_DEFAULT;
     }
     if (!isset($page_class)) {
         $page_class = preg_replace('[^a-zA-Z0-9-_]', '', str_replace('/', '-', $this->view));
     }
     require $this->lf;
 }
Example #2
0
 /**
  * Creates the HTML for the datalist element.
  * 
  * @return string
  */
 public function __toString()
 {
     $html = sprintf('<datalist id="%s">', get::encodedAttribute($this->getId()));
     if (is::assoc_array($this->list)) {
         foreach ($this->list as $value => $lbl) {
             $html .= sprintf('<option label="%s" value="%s" />', get::encodedAttribute($lbl), get::encodedAttribute($value));
         }
     } else {
         foreach ($this->list as $value) {
             $html .= sprintf('<option value="%s" />', get::encodedAttribute($value));
         }
     }
     $html .= '</datalist>';
     return $html;
 }
Example #3
0
 public function __toString()
 {
     if (isset($this->params) && is_array($this->params) && is::assoc_array($this->params)) {
         extract($this->params);
     }
     $this->helpers = get::helpers('template');
     if (count($this->helpers) > 0) {
         extract($this->helpers);
     }
     ob_start();
     require $this->file;
     $data = ob_get_contents();
     ob_end_clean();
     return $data;
 }