you should have a subfolder /xml/ then:
/View/controller/xml/view.ctp

I just recently had to work with pdf as extension:
http://www.dereuromark.de/2011/11/21/serving-views-as-files-in-cake2/


On 12 Dez., 03:58, Deryck <ddden...@gmail.com> wrote:
> I am using CakePHP 2.0 (I believe it is v2.0.3.) and PHP 5.3.8.
>
> I am working on an application which utilizes Cake's support for url
> extensions.  Specifically, I am outputing XML whenever a url request
> ends in the .xml extension.  If the url request is made without
>
> any extension, then my application presents the stardard view.  This
> all works beautifully --
>
>         request .../controller/action.xml renders via view/controller/xml/
> action.ctp while request .../controller/action renders via view/
> controller/action.ctp.
>
> To achieve this, I did the following:
>
>         1. Added support for url extension; added the following line to
> route.php -- Router::parseExtensions('xml');
>         2. Added support request handling; added the following line to
> MyController.php -- public $components = array('Session',
> 'RequestHandler');
>
> To output xml, I am using Cake's 'XML' class in conjunction with PHP's
> 'SimpleXMLElement' class.  My problem is that the complete xml is
> never generated.  The classes are suppose to generate xml based
>
> on an input PHP array, however, it appears that the complete array is
> not processed.  My xml output is partial.
>
> My source code in my view file (.ctp) is as follows:
>
> $simple_xml_elem = Xml::build($xml_array);
> echo $simple_xml_elem->asXML();
>
> Interestingly, in the course of trying to debug this problem, I
> discovered the a similar behaviour can be observed if I simple attempt
> to dump the view object within the xml view file
>
> (../view/controller/xml/action.ctp).  'var_dump($this)' only output a
> partial dump of the view.  The same view dump performed within the
> standard view file (../view/controller/action.ctp) outputs a full
>
> dump of the view.
>
> It is my believe that Cake is somehow setting up the view environment
> differently when it routes for a url extension than when the standard
> view is requested.
>
> Could some please shed some light on the for me before I lose my
> hair.  Please???? Thanks!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to