I'm migrating one of my website from cake 1.3 to 2开发者_如何学运维.0 rc1 and I have a problem with my rss feed.
When I call my feed with something like mydomain.com/mycontroller/index.rss I have an error :
Error: The action index.rss is not defined in controller MycontrollerController
Error: Create MycontrollerController::index.rss() in file: app/Controller/MycontrollerController.php.
<?php
class MycontrollerController extends AppController {
function index.rss {
}
}
...
?>
I didn't change anything since 1.3 (and rss were working), and I have the parseExtensions in my routes.php :
Router::parseExtensions('rss', 'xml');
I found nothing about it in the doc and google :(
Thanks a lot !
The action in your controller shouldn't be named index.rss
.
You should verify a few things:
• Are both the TextHelper
and RequestHandlerComponent
called in your controller?
• Have you created an index action with the following code?
if ($this->RequestHandler->isRss() ){
$posts = $this->YourModel->find('all', array('limit' => 20, 'order' => 'Post.created DESC'));
return $this->set(compact('posts'));
}
• Verify you have created a default.ctp in /View/Layouts/rss/
• Do the same for the RSS view in /View/YOUR_CONTROLLER/rss/index.ctp
Also, see the manual entry in the Cake documentation.
If that doesn't solve the issue it could be related to URL rewriting with mod_rewrite. Do you have any other problems with URLs not being found?
精彩评论