Re: XML rendering
Ahh, I finally figured it out. I was using a TidyFilter Helper for another view and it was changing the results of the output! I guess the lesson learned is keep track of your helpers... On May 10, 7:48 pm, Aaron Torres tcb...@gmail.com wrote: 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 -~--~~~~--~~--~--~---
Re: XML rendering
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-feed-cakephp-models 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 -~--~~~~--~~--~--~---
Re: XML rendering
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 -~--~~~~--~~--~--~---
XML rendering
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 -~--~~~~--~~--~--~---
Re: Blank lines at top of XML rendering
Dave Barter wrote: Check you files for blank lines after ? at the end of the file. Also check for blank lines at the TOP of php files, and possibly in the MIDDLE if you close and open your php tags. I noticed that I had a blank line at the very top of all my HTML output and it turned out to be a blank line in one of my model php files. I had commented out some code in this fashion inside \app\models\mymodel.php: BOF ? /* [... my commented code here ...] */ ? ? [... the actual code body of mymodel.php here ...] ? EOF The fix was to remove the unnecessary ?[blank line]? after my commented code, which is obviously a cleaner way of structuring my php file. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Blank lines at top of XML rendering
I'm running to the same exact error, if anyone has any more input on this i'd appriciate it. I've been search everywhere i can think of to find some sort of answer/reason/workaround for this. i tried to flush the output buffer, but that isn't helping the situation. also, its not a matter of the content_for_layout having an extra space in there. its odd, i can redirect the header from the layout file, but i can't change the headers content type from there. maybe it should go elsewhere? i've tried not rendering a layout and change the view to an xml file, but that didn't work either. any ideas? On Nov 14, 9:43 pm, realien [EMAIL PROTECTED] wrote: Hi guys, We've created a REST based webservice with cake, and when we set the layout of the controller to var $layout = 'xml'; and we have views for each of the actions on the controller that wil render the xml. code ?php /* turn off browser caching */ header( Expires: Mon, 20 Dec 1998 01:00:00 GMT ); header( Last-Modified: . gmdate(D, d M Y H:i:s) . GMT ); header( Cache-Control: no-cache, must-revalidate ); header( Pragma: no-cache ); header( Content-Type: text/xml ); echo ?xml version=\1.0\ encoding=\UTF-8\?\n; echo $content_for_layout; ? /code What we are seeing is we always get 1 or 2 blank lines at the top of the xml rendering, which firefox complains about when the xml is served (IE puts up with it). We've checked our php files for lead or trailing blank lines and there are none. Has anyone else seen this issue? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Blank lines at top of XML rendering
Hey Dave, i double checked all files from cake and none have a space after any php close tag (if there was it should/does generate an error, depending on which file its in of course). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Blank lines at top of XML rendering
Hi realien, If you are using the above code, and /NOT/ getting header already sent errors (you have debug set 0, right?) The only answer is that your content_for_layout starts with a space. If you are getting an error message, it's worth reading - especially the bit where it tells you the file and line that started sending stuff to the browser :). HTH, AD7six Please note: The manual/bakery is a good place to start any quest for info. The cake search (at the time of writing) erroneously reports less/no results for the google group. The wiki may contain incorrect info - read at your own risk (it's mainly user submitted) :) You may get your answer quicker by asking on the IRC Channel (you can access it with just a browser here: http://irc.cakephp.org). On Nov 15, 6:43 am, realien [EMAIL PROTECTED] wrote: Hi guys, We've created a REST based webservice with cake, and when we set the layout of the controller to var $layout = 'xml'; and we have views for each of the actions on the controller that wil render the xml. code ?php /* turn off browser caching */ header( Expires: Mon, 20 Dec 1998 01:00:00 GMT ); header( Last-Modified: . gmdate(D, d M Y H:i:s) . GMT ); header( Cache-Control: no-cache, must-revalidate ); header( Pragma: no-cache ); header( Content-Type: text/xml ); echo ?xml version=\1.0\ encoding=\UTF-8\?\n; echo $content_for_layout; ? /code What we are seeing is we always get 1 or 2 blank lines at the top of the xml rendering, which firefox complains about when the xml is served (IE puts up with it). We've checked our php files for lead or trailing blank lines and there are none. Has anyone else seen this issue? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Blank lines at top of XML rendering
I've had a similar issue, which was resolved when I used ob_clean(). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Blank lines at top of XML rendering
Hi guys, We've created a REST based webservice with cake, and when we set the layout of the controller to var $layout = 'xml'; and we have views for each of the actions on the controller that wil render the xml. code ?php /* turn off browser caching */ header( Expires: Mon, 20 Dec 1998 01:00:00 GMT ); header( Last-Modified: . gmdate(D, d M Y H:i:s) . GMT ); header( Cache-Control: no-cache, must-revalidate ); header( Pragma: no-cache ); header( Content-Type: text/xml ); echo ?xml version=\1.0\ encoding=\UTF-8\?\n; echo $content_for_layout; ? /code What we are seeing is we always get 1 or 2 blank lines at the top of the xml rendering, which firefox complains about when the xml is served (IE puts up with it). We've checked our php files for lead or trailing blank lines and there are none. Has anyone else seen this issue? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---