I am using this block of code as i use httpSocket to get some data in xml
from a site.The $results variable contains my returned data in Xml and with
the code i gave you i cant make them appear in a simple way to check if my
request is working.

2009/6/19 taufiq ridha <taufiq.ri...@gmail.com>

>
> Hi guys thanks for all the answer, and that's worked :D
>
> my next questions, how i can get this xml with output costum, let's
> say i dont wanna fetch all the variable, like i just wanna fetch user
> with some attribute not all,
> because for now, it still fetch all data and all relations with user
> table, see :
>
> /* i just wanna fetch username and email*/
> <user>
>  <username>taufiqridha</username>
>  <email>tau...@gmail.com</email>
> </user>
>
> anyway paulos, where i can put this code :D, remembering i'm very new
> on this, can u give me more details :D
>
> thanks for all guys, it's very helped me out
>
> cheers
>
> On Jun 19, 1:16 pm, Adam Royle <a...@sleekgeek.com.au> wrote:
> > Put this in app/views/users/xml/index.ctp
> >
> > <?php
> > echo '<users>';
> > echo $xml->serialize($users, array('format' => 'tags'));
> > echo '</users>';
> > ?>
> >
> > and put this in app/views/layouts/xml/default.ctp
> >
> > <?php
> > echo $xml->header();
> > echo $content_for_layout;
> > ?>
> >
> > XML it doesn't show as XML in your browser if debug is set to 2,
> > because RequestHandler won't output the necessary headers. If that's
> > the case, add this in your AppController's beforeFilter() to override
> > this behaviour:
> >
> > if (!empty($this->params['url']['ext']) && $this->params['url']['ext']
> > == 'xml' && Configure::read('debug') > 0) {
> >     Configure::write('debug', 1);
> >
> > }
> >
> > And then it should all work!
> >
> > Cheers,
> > Adam
> >
> > On Jun 19, 4:43 am, taufiq ridha <taufiq.ri...@gmail.com> wrote:
> >
> >
> >
> > > Hello, nice to meet u all!!
> > > sorry for this stupid question, but i'm really new on this framework.
> > > i was try to search for this subject, but not find yet, so i decided
> > > to ask for all guru's here :)
> >
> > > i want to build flash site, which cake php will provide xml for my
> > > flash,
> >
> > > here's what i was done to get xml :
> >
> > > Routes by adding :
> > > Router::parseExtensions();
> >
> > > on the controller :
> >
> > > <?php
> > > class UsersController extends AppController {
> >
> > >         var $name = 'Users';
> > >         var $helpers = array('Html', 'Form');
> > >         var $components = array('RequestHandler');
> >
> > >         function index() {
> > >                 $this->User->recursive = 0;
> > >                 $this->set('users', $this->paginate());
> > >         }}
> >
> > > ?>
> >
> > > finnaly here's code for my views on views/users/xml/index.ctp
> >
> > > <?php
> > > echo $xml->serialize($users);
> > > ?>
> >
> > > Now, when i pointing tohttp://localhost/example/users/index.xmligot
> > > very messy xml
> >
> > > <?xml version="1.0" encoding="UTF-8" ?><user id="1"
> > > username="taufiqridha" password="taufiq123"
> > > email="taufiq.ri...@gmail.com" name="Taufiq Ridha" birth="2009-06-17"
> > > sex="1" city="Jakarta" phone="2147483647" avatar_face_id="1"
> > > avatar_hair_id="1" avatar_top_id="1" avatar_bottom_id="1"
> > > avatar_shoe_id="1" avatar_acc1_id="1" avatar_acc2_id="1" shout="ini
> > > shout out 2" point="0" created="2009-06-17 01:05:50"
> > > modified="2009-06-17 01:32:07"><avatar_face id="1" name="Gondrong"
> > > sex="1" path_image="http://taufiq-ridha.co.cc"; created="2009-06-14
> > > 20:14:27" modified="2009-06-14 20:14:27" /><avatar_hair id="1"
> > > name="Belah Tengah" sex="1" path_image="http://taufiq-ridha.co.cc";
> > > created="2009-06-14 20:15:31" modified="2009-06-14 20:15:31"
> /><avatar_top id="1" name="Atasan Kurus" sex="1" path_image="http://
> >
> > > taufiq-ridha.co.cc" created="2009-06-14 20:16:09" modified="2009-06-14
> > > 20:16:09" /><avatar_bottom id="1" name="Changcutters Style" sex="1"
> > > path_image="http://taufiq-ridha.co.cc"; created="2009-06-14 20:16:35"
> > > modified="2009-06-14 20:16:35" /><avatar_shoe id="1" name="Sepatu
> > > Jungle" sex="1" path_image="http://taufiq-ridha.co.cc";
> > > created="2009-06-14 20:17:38" modified="2009-06-14 20:17:38"
> /><avatar_acc1 id="1" name="Gelang Punk" sex="1" path_image="http://
> >
> > > taufiq-ridha.co.cc" created="2009-06-14 20:16:59" modified="2009-06-14
> > > 20:16:59" /><avatar_acc2 id="1" name="Topi Koboi" sex="1"
> > > path_image="http://taufiq-ridha.co.cc"; created="2009-06-14 20:17:16"
> > > modified="2009-06-14 20:17:16" /><point id="" user_point="" user_id=""
> > > created="" modified="" /><shout id="4" content="dimana yah shout 5"
> > > user_id="1" created="2009-06-14 23:51:53" modified="2009-06-18
> > > 14:00:35" /></user>
> >
> > > did anyone know how to make this xml more friendly(costum) also with
> > > list view, just like :
> >
> > > <?xml version="1.0" encoding="UTF-8" ?>
> > >    <users>
> > >        <username>taufiq ridha</username>
> > >       <avatar_face>1</avatar_face>
> > >       <avatar_hair>2</avatar_hair>
> > >       /* and so on */
> > >    </users>
> > > </xml>
> >
> > > thanks for advice guys, and sorry for this basic questions
> >
> > > regards
> >
>

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