[]define('WEBSERVICES', 'on');
make a rest.php file in controllers/componentsand did you make the corresponding table in your db for the controller? On Thu, Apr 15, 2010 at 12:07 AM, ivan <[email protected]> wrote: > I followed the steps as in > http://bakery.cakephp.org/articles/view/restful-web-services-with-cakephp. > > and this is what I do: > 1. in controllers/components > <?php > class RestComponent extends Object { > } > ?> > 2. make a rest.php file in views/helpers > <?php > class RestHelper extends Helper > { > } > ?> > 3. In views/layouts make a folder called 'rest' and put a > default.thtml file in it > <?php e('<?xml version="1.0" encoding="utf-8" ?>'); ?> > <?php echo $content_for_layout; ?> > 4. in models/pencarian_kata_kitabs.php > <?php > class PencarianKataKitab extends AppModel { > > var $name = 'PencarianKataKitab'; > var $belongsTo = array( > 'Alkitab' => array( > 'className' => 'Alkitab', > 'foreignKey' => 'KITAB_ID', > 'conditions' => '', > 'fields' => '', > 'order' => '' > ), > 'TempKata' => array( > 'className' => 'TempKata', > 'foreignKey' => 'KATA_ID', > 'conditions' => '', > 'fields' => '', > 'order' => '' > ) > ); > var $validate = array( > 'KITAB_ID' => array('numeric',VALID_NOT_EMPTY), > 'KATA_ID' => array('numeric',VALID_NOT_EMPTY) > ); > > } > ?> > 5. in controllers/pencarian_kata_kitabs_controller.php > function listing() { > $this->set('alkitabku', ClassRegistry::init("Alkitab")- > >find('all', > array( > 'conditions'=>array( > "and"=>array( > 'CONCAT(Alkitab.kitab," > ",Alkitab.pasal) like '=>'mazmur', > 'CAST(Alkitab.ayat AS UNSIGNED) > >='=>'1', > 'CAST(Alkitab.ayat AS UNSIGNED) > <='=>'1' > ) > ) > ) > )); > } > 6. in views/pencarian_kata_kitabs/rest/listing.thtml > if (isset($alkitabku) and !empty($alkitabku)) : ?> > <rsp stat="ok"> > <alkitabku type='array'> > <?php foreach ($alkitabku as $country) : ?> > <country type='struct'> > <id><?php e($country['Alkitab']['ISI'])?></id> > </country> > <?php endforeach; ?> > </alkitabku> > <?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> > > when i access http://localhost/alkitab/rest/pencarian_kata_kitabs/listing, > this result is > not found > Error: The requested address '/rest/pencarian_kata_kitabs/listing' was > not found on this server. > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<cake-php%[email protected]>For > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 To unsubscribe, reply using "remove me" as the subject.
