Matt,

xml->serialize looks cakephp 1.3, 
http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html?highlight=rss

You could also just do a foreach on the array to manually output at the view…

Andras Kende



On Nov 8, 2011, at 11:27 PM, Matthew Kaufman wrote:

> Hello,
> 
> Setting up REST is always frustrating for me at first honestly in Cake.  I 
> prefer to interact with my applications to add data via Curl on the command 
> line;
> 
> Let's start out at Step 1 Though:
> 
> /app/Config/routes.php:
> ----
> Router::mapResources('training_categories');
> Router::mapResources('central_index_keys');
> Router::mapResources('standard_industrial_classification_codes');
> Router::parseExtensions('json', 'xml');
> 
> /app/Controllers/StandardIndustrialClassificationCodesController.php
> ----
> class StandardIndustrialClassificationCodesController extends AppController 
> {
>     var $components = array('RequestHandler');
> 
> /**
>  * index method
>  *
>  * @return void
>  */
>     public function index() {
>         $this->StandardIndustrialClassificationCode->recursive = 0;
>         $this->set('standardIndustrialClassificationCodes', 
> $this->paginate());
>         $this->set('standard_industrial_classification_codes', 
> $this->paginate());
>         
>         //$standard_industrial_classification_codes = 
> $this->StandardIndustrialClassificationCode->find('all');
>         //$this->set(compact('standard_industrial_classification_codes')); 
>     }
> 
> ------------------------------------------------------------------------
> 
> root@mkfmnweb:/var/www/cake_2_0/app/View# cat 
> StandardIndustrialClassificationCodes/xml/index.ctp 
> <?php 
> // app/views/standard_industrial_classification_codes/xml/index.ctp
> ?>
> 
> <standard_industrial_classification_codes>
>     <?php $xml->serialize($standard_industrial_classification_codes); ?>
> </standard_industrial_classification_codes>
> 
> 
> root@mkfmnweb:/var/www/cake_2_0/app/View# 
> 
> ------------------------------------------------------------------------
> 
> Anyway, when I try to access 
> http://192.168.1.100/cake_2_0/standard_industrial_classification_codes.xml it 
> should render properly; but now it tells me that I have an undefined 
> variable; or "Call to a member function serialize() on a non-object in my 
> StandardIndustrialClassificationCodes/xml/index.ctp on line 6" ---- 
> Attatching a screenshot to this message.
> 
> How can I setup basic REST?
> 
> Another thing I would like to know is how can I best lay out in the 
> controller to support basic Browser based form INSERT's 
> (Controller/StandardIndustrialClassificationCodeController.php > add()) with 
> the scaffold generated HTML form view as well as doing a curl -X POST to 
> http://server/cake_2_0/standard_industrial_classification_codes/add.xml with 
> the data inputted from their sent in with XML headers on it?  That is my 
> secondary question.
> 
> First question is how can I get the new Cake to list me out my nice XML? :).
> 
> Thanks,
> Matt Kaufman
> 
> -- 
> 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
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php
> <cake-rest-problem.jpg>

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to