I'm really stumped about this problem, I hope someone can be of
assistance.
I'm trying to out put a view as xml and have read through the
documentation and tutorials, but I must be missing something.
In my routes file I have:
Router::parseExtensions("xml");
In my controller file:
var $components = array('RequestHandler');
def data(){
$message = 'Testing';
$this->set('message', $message);
}
I have a layout file views/layouts/xml/default.ctp:
<?php header('Content-type: text/xml'); ?>
<?php echo $content_for_layout ?>
and a file views/modelname/xml/data.ctp:
<test>
<case><?php echo $message; ?></case>
</test>
When I navigate to localhost/modelname/data.xml and hit view source I
end up with:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
Testing <!-- 0.1479s -->
</body>
</html>
Does anyone have an idea about what I'm doing wrong? I've tried
removing the layout as well and I end up with:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
Testing <!-- 0.1546s -->
</body>
</html>
(notice the top line)
I appreciate any help you can provide.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---