Changeset 647
- Timestamp:
- 07/11/08 18:01:59 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 2 added
- 1 removed
- 2 modified
-
controllers/news_controller.php (modified) (1 diff)
-
views/layouts/portal.ctp (modified) (1 diff)
-
views/news/rss (added)
-
views/news/rss.ctp (deleted)
-
views/news/rss/rss.ctp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/news_controller.php
r636 r647 62 62 } 63 63 64 /**64 /** 65 65 * Create an rss feed of the 15 last uploaded uses the RSS component 66 66 * 67 */ 68 public function rss() 67 */ 68 public function rss() 69 { 70 71 $channelData = array('title' => 'Karamelo eLearning Portal ', 72 'link' => array('controller' => 'news', 'action' => 'display'), 73 'url' => array('controller' => 'news', 'action' => 'display'), 74 'description' => 'Latest news on Karamelo', 75 'language' => 'en-us' 76 ); 77 78 $conditions = array("News.status"=>1); 79 80 $fields = array("News.id", "News.title", "News.body", "News.created", "News.theme_id", "News.user_id"); 81 82 $order = "News.id DESC"; 83 84 $limit = 15; 85 86 $this->News->unbindModel(array('hasMany'=>array('Discussion'))); 87 88 $news = $this->News->findAll($conditions, $fields, $order, $limit); 89 90 $this->set(compact('channelData', 'news')); 91 } 92 93 public function category($id=null, $order=null) 94 { 95 $this->layout = 'portal'; 96 97 if ($id == null) 69 98 { 70 $this->layout = 'rss';71 72 $conditions = array("News.status"=>1);73 74 $fields = array("News.id", "News.title", "News.body", "News.created", "News.theme_id", "News.user_id");75 76 $order = "News.id DESC";77 78 $limit = 15;79 80 $this->News->unbindModel(array("hasMany"=>array("Comentnews")));81 82 $this->set('data', $this->News->findAll($conditions, $fields, $order, $limit));83 84 }85 86 public function category($id=null, $order=null)87 {88 $this->layout = 'portal';89 90 if ($id == null)91 {92 99 $this->redirect('/'); 93 }94 95 $conditions = array('Theme.id' => $id);96 97 $fields = array("News.id", "News.title", "Theme.theme", "Theme.img");98 99 $this->pageTitle = 'News Category';100 101 $limit = 30;102 103 $this->set('data', $this->News->findAll($conditions, $fields, $order, $limit));104 105 $this->Portal->statics(); // Charge Portal components aka Sidebars106 100 } 101 102 $conditions = array('Theme.id' => $id); 103 104 $fields = array("News.id", "News.title", "Theme.theme", "Theme.img"); 105 106 $this->pageTitle = 'News Category'; 107 108 $limit = 30; 109 110 $this->set('data', $this->News->findAll($conditions, $fields, $order, $limit)); 111 112 $this->Portal->statics(); // Charge Portal components aka Sidebars 113 } 107 114 108 115 /*** ======ADMIN METHODS === *****/ -
trunk/app/views/layouts/portal.ctp
r634 r647 18 18 echo $html->css("portal/portal"); 19 19 ?> 20 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/news/rss /" />20 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/news/rss.rss" /> 21 21 <link rel="shortcut icon" href="/favicon.ico" /> 22 22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
