<?php  
	class HomesController extends AppController{
		public $name = 'Homes';
		public $components = array('RequestHandler', 'Session');
		public $uses = array('Home','Banner','Event','EventCategory','EventSubCategory','News');
		
		
		
		public function index(){
			$data = $this->Home->find('all');
			$this->set(compact('data'));
			
			$ban = $this->Banner->Find('all', array('conditions'=>array('status'=>'1'),'limit'=>'4','order'=>'id desc'));
			$this->set(compact('ban'));
			
			$event = $this->Event->find('all', array('conditions'=>array('status'=>'1'),'limit'=>'4','order'=>'id desc'));
			$this->set(compact('event'));
			
			$new = $this->News->find('all', array('conditions'=>array('status'=>'1'), 'limit'=>'3', 'order'=>'id desc'));
			$this->set(compact('new'));
			//debug($new);exit;
			
			
		}
		
		public function details($id = null){
			$new = $this->News->find('all', array('conditions'=>array('status'=>'1'), 'limit'=>'3', 'order'=>'id desc'));
			$this->set(compact('new'));
			
			if(!$id){
				throw new NotFoundException('Invalid Id');
			}	
			$news = $this->News->findByid($id);
			if(!$news){
				throw new NotFoundException('Invalid news');
			}
			
			$this->set(compact('news'));
			}
		
		
		
		
		
		
		
		
		
		
	}




?>