Beispiel #1
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('id' => null);
     if ($blockParams['id']) {
         $oldVars = $this->vars;
         $this->vars = SlNode::get($blockParams['id'], array('auth' => true));
     }
     if ($blockName === 'NodeView') {
         $skin = empty(SL::getInstance()->view->params['named']['skin']) ? Inflector::camelize($this->_getVar('CmsNode.skin')) : Inflector::camelize(SL::getInstance()->view->params['named']['skin']);
         $skin = $skin && Pheme::init("NodeView{$skin}") ? "NodeView{$skin}" : "NodeViewDefault";
     } else {
         $skin = $blockName;
     }
     if ($skin != $blockName) {
         PhemeParser::$parseCallStack[] = Pheme::get($skin);
         $result = parent::parse($html, $skin);
         array_pop(PhemeParser::$parseCallStack);
     } else {
         $result = parent::parse($html, $skin);
     }
     if (isset($oldVars)) {
         $this->vars = $oldVars;
     }
     return $result;
 }
 public function view($id)
 {
     $this->set('tag', $tag = $this->CmsTag->read(null, $id));
     if (!$tag) {
         $this->cakeError();
     }
     if ($tag['CmsTag']['node_id']) {
         $this->set('node', $node = SlNode::get($tag['CmsTag']['node_id']));
     }
     if ($node) {
         $this->set('title', $node['CmsNode']['title']);
     } else {
         $this->set('title', $tag['CmsTag']['name']);
     }
     // get all nodes associated with the CmsTag
     $this->set('nodes', SlNode::find('all', array('conditions' => array('TagFilter.id' => $id), 'link' => array('CmsNodesTags' => array('TagFilter' => array('class' => 'CmsTag', 'conditions' => 'TagFilter.id = CmsNodesTags.tag_id', 'fields' => array('TagFilter.id')))))));
 }