Problem generating view for REST webservice in cakephp 2.0
Strange problems here.
Firstly, the default default.ctp for XML looked like this:
<?php echo $xml->header(); ?>
<?php echo $content_for_layout; ?>
which lead to:
Notice (8): Undefined variable: xml [APP/View/Layouts/xml/default.ctp,
line 1]
no problem, removed the first line of default.ctp
My /logs/xml/index.ctp view looks like this:
<?php
$xml = Xml::fromArray($logs);
echo $xml->asXML();
?>
served up from this controller action:
public function index() {
$logs = $this->Log->find('all');
$this->set(compact('logs'));
}
and my routes contains:
Router::mapResources('logs');
Router::parseExtensions();
result is the following error:
The key of input must be alphanumeric
Error: An Internal Error Has Occurred.
Stack trace is:
#0 /exports/www/ErrorLogger/View/Logs/xml/index.ctp(2):
Xml::fromArray(Array)
#1 /usr/share/php/cakephp/lib/Cake/View/View.php(598): include('/
exports/www/Er...')
#2 /usr/share/php/cakephp/lib/Cake/View/View.php(365): View->_render('/
exports/www/Er...')
#3 /usr/share/php/cakephp/lib/Cake/Controller/Controller.php(898):
View->render(NULL, NULL)
#4 /usr/share/php/cakephp/lib/Cake/Routing/Dispatcher.php(114):
Controller->render()
#5 /usr/share/php/cakephp/lib/Cake/Routing/Dispatcher.php(89):
Dispatcher->_invoke(Object(LogsController), Object(CakeRequest),
Object(CakeResponse))
#6 /exports/www/ErrorLogger/webroot/index.php(96): Dispatcher-
>dispatch(Object(CakeRequest), Object(CakeResponse))
#7 {main}
Any ideas where this has gone wrong? help!
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home