Ah, that file path was actually a typo:

app/views/controllername/xml/data.ctp (same name as the controller
action) actually contains:
<test>
    <case><?php echo $message; ?></case>
</test>

I accidentally omitted controllername from the full path, but it's
definitely correct and I'm getting the same results. What's bothering
me is where is the html in the end result coming from? It seems that
it's incorrectly rendering an xhtml layout with an xml tag ( <?xml
version="1.0" encoding="utf-8"?> ) at the top. I'll take a look at
your article in more detail tomorrow when I have access to the code
again. For now, does anyone else have any idea what might be going on?




On May 10, 9:17 am, Smelly Eddie <ollit...@gmail.com> wrote:
> AAron:
>
> I am not sure what your adding to app/xml/data.ctp for.  This should
> be handled like any other view.
>
> You need;
>
> The parse xml extensions config (which you have)
> A controller action (your's looks good)
> An XML view (app/views/CONTROLLERNAME/xml/CONTROLLERACTION.xml
>
> Here's an article I wrote after implementing RSS feeds on one of my
> sites.,
>
> http://edwardawebb.com/programming/php-programming/cakephp/add-rss-fe...
>
> On May 8, 5:54 pm, Aaron Torres <tcb...@gmail.com> wrote:
>
> > First off, sorry if this is a duplicate, I submitted a post an hour
> > ago and it still hasn't shown up so I thought I'd try one more time.
>
> > I'm having extreme difficulty getting cakephp to render xml for me.
> > I've looked through the google groups, the docs, and blog posts via
> > google and as far as I can tell I've done everything that has been
> > suggested.
>
> > In my routes file:
> > Router::parseExtensions("xml");
>
> > In my controller:
> > var $components = array('RequestHandler');
>
> > function data(){
> >         $message = 'Testing';
> >         $this->set('message', $message);
>
> > }
>
> > I've verified that app/data.xml tries to render views/app/xml/data.ctp
> > and also views/layouts/xml/default.ctp (if I create it)
>
> > In views/app/xml/data.ctp:
> > <test>
> >     <case><?php echo $message; ?></case>
> > </test>
>
> > However, when I navigate to app/data.xml this is what is returned:
> >  <?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.1864s -->
> >   </body>
>
> > </html>
>
> > I've ran out of ideas, does anyone have any suggestions to get this
> > working?
>
> > Thanks in advance for any insights you can provide and again, sorry if
> > this posts twice.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to