Exemple #1
0
 public function actionIndex()
 {
     $feed_title = Awecms::getSiteName();
     $feed_description = Settings::get('site', 'tagline');
     //provide model name or array of models, implementing page behavior
     $pageModels = array('Page', 'News', Event::model()->findAll());
     //for models other than implementing Page behavior
     $otherModels = array(array('Album', 'title', 'content', '/gallery/album/view/id/{id}'), array('Business', 'title', 'content', '/directory/business/view/id/{id}'), array('Image', 'title', 'description', '/gallery/image/view/id/{id}'));
     foreach ($otherModels as $otherModel) {
         $link = isset($otherModel[3]) ? $otherModel[3] : NULL;
         $this->addToFeed($otherModel[0], $otherModel[1], $otherModel[2], $link);
     }
     foreach ($pageModels as $model) {
         $this->addToFeed($model, 'title', 'content');
     }
     // generate and render RSS feed
     $feed = Zend_Feed::importArray(array('title' => $feed_title, 'description' => $feed_description, 'link' => $this->createUrl(''), 'charset' => 'UTF-8', 'generator' => 'AweCMS', 'entries' => $this->entries), 'rss');
     $feed->send();
 }
Exemple #2
0
 public static function getTitlePrefix()
 {
     return ' | ' . Awecms::getSiteName();
 }
Exemple #3
0
 public function beforeRender($view)
 {
     //some SEO stuffs here
     if ($this->pageRobotsIndex == false) {
         Yii::app()->clientScript->registerMetaTag('noindex', 'robots');
     }
     if (Settings::get('SEO', 'enable_meta_description_for_all_pages')) {
         $meta_description = Settings::get('SEO', 'meta_description');
         if (!empty($meta_description)) {
             Yii::app()->clientScript->registerMetaTag($meta_description, 'description');
         }
     }
     if (Settings::get('SEO', 'enable_meta_keywords')) {
         if (empty($this->pageKeywords)) {
             $this->pageKeywords = Settings::get('SEO', 'meta_keywords');
         }
     }
     if (Settings::get('SEO', 'enable_open_graph_meta_tags')) {
         $site_name = Awecms::getSiteName();
         if (!empty($site_name)) {
             Yii::app()->clientScript->registerMetaTag($site_name, NULL, NULL, array('property' => 'og:site_name'));
         }
         if (!empty($this->pageTitle)) {
             Yii::app()->clientScript->registerMetaTag($this->pageTitle, NULL, NULL, array('property' => 'og:title'));
         }
         $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
         Yii::app()->clientScript->registerMetaTag($protocol . $_SERVER['HTTP_HOST'] . Yii::app()->request->requestUri, NULL, NULL, array('property' => 'og:url'));
         if (!empty($meta_description)) {
             Yii::app()->clientScript->registerMetaTag($meta_description, NULL, NULL, array('property' => 'og:description'));
         }
     }
     if ($this->pageKeywords) {
         Yii::app()->clientScript->registerMetaTag($this->pageKeywords, 'keywords');
     }
     Yii::app()->clientScript->registerMetaTag('AweCMS ' . Awecms::version, 'generator');
     return parent::beforeRender($view);
 }