0

I got 2 different problems:

  1. Error while render default request (html)
  2. Error while render rss request.

Here is my code:

class PagesController extends AppController {
    public $name = 'Pages';
    public $components = array('RequestHandler');
    public $helpers = array('Text');
}

Below is code for normal request.

  //problem #1:
  public function display() { 
    $path = func_get_args();

    $count = count($path);
    if (!$count) {
            $this->redirect('/');
    }

    $page = $subpage = $title_for_layout = null;

    if (!empty($path[0])) {
            $page = $path[0];
    }

    if (!empty($path[1])) {
            $subpage = $path[1];
    }

    if (!empty($path[$count - 1])) {
            $title_for_layout = Inflector::humanize($path[$count - 1]);
    }

    $this->setDefaultMeta();
    $this->layout = 'default';
    $this->set(compact('page', 'subpage', 'title_for_layout'));
    $this->render(implode('/', $path));
} 

And this is for rss request

 public function feeds(){  
    if( $this->RequestHandler->isRss() ){ 
        $this->loadModel('Deal');
        $arrId = $this->Deal->DealBuyCondition->listAliveID();

        $posts = $this->Deal->rssFeeds($arrId);  
        return $this->set(compact('posts'));
    }
    die('rss only');
    return false;
}

First function returned errors:

Warning (2): call_user_func_array() expects parameter 1 to be a valid callback, class 'RequestHandlerComponent' does not have a method 'beforeRender' [CORE\Cake\Utility\ObjectCollection.php, line 132]

Warning (2): call_user_func_array() expects parameter 1 to be a valid callback, class 'RequestHandlerComponent' does not have a method 'shutdown' [CORE\Cake\Utility\ObjectCollection.php, line 132]

and the second function did not properly rendered as RSS.

Please help.

Anthon
  • 69,918
  • 32
  • 186
  • 246

1 Answers1

0

Your CakePHP setup might be messed up. RequestHandlerComponent does have a beforeRender method and also shutdown method (inherited from parent Component) so those errors weird. Try getting a fresh copy of CakePHP.

ADmad
  • 8,102
  • 16
  • 18