Hello!
In my controller I have function called "add".
I use the requestAction to retreave an array that contains one record
of the model Sucursals.

<--Cortes_Controller.php-->
class CortesController extends AppController
{
   function add() {

$this->set('sucursal',$this->requestAction('sucursals/view/1'));
   }
}

This should send the array or variable $sucursal that contains the data
returned from the
controller "sucursals_controller.php" with an action called "view"
accepting one parameter in this case '1'.
I Try to echo the array $sucursal in my view with this code:
<--../views/cortes/add.thtml-->
<h1>Corte</h1>
<?php echo $sucursal ?>

I get nothing. I tried calling the scaffold action "show" with the same
parameter and it returns the whole html (at least it returns something)
not the array. I read the manual and I thought that was the way to
retreave data from another table in my view without repeating code.

It seems that the scaffold method does is equivalent as using :

$this->set('sucursal',$this->requestAction('sucursals/view/1')),
array('return');

I tried this way and if I create  a view.thml for the controller
sucursals and render some html and  it does what the manual says it
supposed to do. Doing it that way works.
But I only want the $array  not the whole html to display a label on my
form.


Can someone point me what I am doing wrong?

The code for the  Controller I am trying to call is:

<-- sucursals_controller.php -->
class SucursalsController extends AppController
{
        var $name = 'Sucursals'; // required for PHP4 installs
        var $scaffold;
        function view($id)
        {
                $this->set('data', $this->Sucursal->read());
        }
}

Thanks for your help!


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

Reply via email to