function index($year = null, $month = null) { if ($year && $month) { $this->paginate['conditions'] = array('NewsArticle.date >=' => $year . '-' . $month . '-1', 'NewsArticle.date <=' => $year . '-' . $month . '-31'); } elseif ($year) { $this->paginate['conditions'] = array('NewsArticle.date >=' => $year . '-1-1', 'NewsArticle.date <=' => $year . '-12-31'); } if (Configure::read('News.layout')) { $this->layout = Configure::read('News.layout'); } else { $this->layout = 'default'; } return parent::index(); }