Exemple #1
0
 public function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
 {
     $this->_hasTitle = false;
     $this->_hasMetaDescription = false;
     $this->_hasMetaKeywords = false;
     $this->_recurseThroughChildren($this);
     if (!$this->_hasTitle) {
         new Typeframe_Tag_Seo_Title('title', array(), $this);
     }
     if (!$this->_hasMetaDescription) {
         new Typeframe_Tag_Seo_Meta('meta', array('name' => 'description'), $this);
     }
     if (!$this->_hasMetaKeywords) {
         new Typeframe_Tag_Seo_Meta('meta', array('name' => 'keywords'), $this);
     }
     $urlmeta = Model_UrlMeta::GetUrl(null, false);
     $tag = null;
     if ($urlmeta->exists()) {
         $seo = Model_SeoHead::Get($urlmeta['id']);
         if ($seo->exists()) {
             if ($seo['extra']) {
                 $fragment = new Pagemill_Node_Frag($this->doctype());
                 $fragment->appendRawText($seo['extra']);
                 $this->appendChild($fragment);
             }
         }
     }
     parent::output($data, $stream);
     // TODO: Do we need to detach the fragment?
 }
Exemple #2
0
 protected function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
 {
     $urlmeta = Model_UrlMeta::GetUrl(null, false);
     if (!$urlmeta->exists()) {
         parent::output($data, $stream);
         return;
     }
     $seo = Model_SeoHead::Get($urlmeta['id']);
     if (!$seo->exists()) {
         parent::output($data, $stream);
         return;
     }
     if (!$seo['title']) {
         parent::output($data, $stream);
         return;
     }
     $title = new Pagemill_Tag_AlwaysExpand('title', $this->attributes(), null, $this->doctype());
     $title->appendText($seo['title']);
     $title->output($data, $stream);
 }