Show
Ignore:
Timestamp:
07/11/08 18:01:59 (4 months ago)
Author:
aarkerio
Message:

News RSS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/news_controller.php

    r636 r647  
    6262 } 
    6363   
    64     /** 
     64 /** 
    6565   * Create an rss feed of the 15 last uploaded uses the RSS component 
    6666   * 
    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) 
    6998   { 
    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       { 
    9299         $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 Sidebars 
    106100   } 
     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  } 
    107114   
    108115  /*** ======ADMIN METHODS === *****/