here are the things I did to get it to work at a bare minimum for a
REST style service

make a rest.php file in components
<?php
class RestComponent extends Object {
}
?>
make a rest.php file in views/helpers
<?php
    class RestHelper extends Helper
    {
    }
?>
in views/layouts make a folder called 'rest' and put a default.thtml file in it
<?php echo $content_for_layout; ?>

for the controller that you want a rest service make a folder called
rest in views/controllername/
in there put the view for the action like
<?php e('<?xml version="1.0" encoding="utf-8" ?>');
if (isset($applications) and !empty($applications)) :  ?>
<rsp stat="ok">
<applications type='array'>
        <?php foreach ($applications as $application) : ?>
                <application type='struct'>
                        <name><?php 
e($application['Application']['name'])?></name>
                        <version><?php 
e($application['Version'][0]['value'])?></version>
                </application>
        <?php endforeach; ?>
</applications>
<?php else: ?>
<rsp stat="fail">
        <err type='struct'>
        <?php if ($session->check('Message.flash')): ?>
                <msg><?php 
e(strip_tags($session->read('Message.flash')));?></msg>
        <?php endif; ?>
        </err>
<?php endif; ?>
</rsp>

That's the basics of what I did, and heck it worked for me.  I started
on an article in the bakery but I am just swamped with work right now
and can't seem to finish it.

Sam D



On 11/29/06, Christoph <[EMAIL PROTECTED]> wrote:
>
> > The manual says that there needs to be an "xml layout" for this to
> > work.  This brings up several questions: how does the *layout* affect
> > the view?  I would think that there needs to be seperate view files for
> > XML just as there are for the HTML.  But that doesn't seem to be the
> > case because the manual doesn't say anything about that.
>
> Actually, the manual does say something about that.  I just missed in
> in the comments.  But the rest of my email remains true.  I just can't
> seem to get native webservices working for the life of me and am hoping
> someone out there has been able to.
>
> thnx,
> Christoph
>
>
> >
>


-- 
==
S. DeVore
(the old fart) the advice is free, the lack of crankiness will cost you

--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to