Exemplo n.º 1
0
 protected function superhero()
 {
     $content = '';
     //Skinny can be used to content from the article into the
     if (class_exists('Skinny') && Skinny::hasContent('superhero')) {
         $content = Skinny::getContent('superhero');
         return $this->renderTemplate('superhero', array('content' => $content));
     }
 }
Exemplo n.º 2
0
 /**
  * Render zone content, optionally passing arguments to provide to
  * object methods
  */
 protected function renderZone($zone, $args = array())
 {
     $sep = isset($args['seperator']) ? $args['seperator'] : ' ';
     if ($this->debug === true) {
         echo "\n\n" . '<!-- Template Zone: ' . $zone . ' -->';
     }
     $content = '';
     if (isset($this->content[$zone])) {
         foreach ($this->content[$zone] as $item) {
             switch ($item['type']) {
                 case 'hook':
                     //method will be called with two arrays as arguments
                     //the first is the args passed to this method (ie. in a template call to $this->insert() )
                     //the second are the args passed when the hook was bound
                     $content .= call_user_func_array($item['hook'], array($args, $item['arguments']));
                     break;
                 case 'html':
                     $content .= $sep . (string) $item['html'];
                     break;
                 case 'template':
                     $content .= $this->renderTemplate($item['template'], $item['params']);
                     break;
                 case 'zone':
                     $content .= $this->renderZone($item['zone'], $item['params']);
                     break;
             }
         }
     }
     //content from #movetoskin and #skintemplate
     if (\Skinny::hasContent($zone)) {
         foreach (\Skinny::getContent($zone) as $item) {
             //pre-rendered html from #movetoskin
             if (isset($item['html'])) {
                 if ($this->debug === true) {
                     $content .= '<!--Skinny:MoveToSkin: ' . $template . '-->';
                 }
                 $content .= $sep . $item['html'];
             } else {
                 //a template name to render
                 if (isset($item['template'])) {
                     if ($this->debug === true) {
                         $content .= '<!--Skinny:Template (via #skintemplate): ' . $item['template'] . '-->';
                     }
                     $content .= $this->renderTemplate($item['template'], $item['params']);
                 }
             }
         }
     }
     return $content;
 }