Perfect - thanks. Here's how I've implemented it:
$variable = $this->Controller->read(null, $id);
$this->set('path', $this->Controller->AssociatedController->getpath
($variable['AssociatedController']['id'], 'id, name'));
$this->set(compact('variable'));
What this allows me to do is show the hierarchical path of a related
field up to the root of the tree in the view. For example, for a
business unit based in a location (which has the tree behaviour) I can
show the path from the location where this business unit is based and
it's parents all the way to the top of the tree.
Thanks.
On Nov 19, 5:38 am, Erik <[email protected]> wrote:
> Jeremy,
>
> $variable will be how you access it in the view template (ctp) file.
> If you still need it in the controller you should do:
> $variable = $this->Controller->read(null, $id);
> // Do some work with $variable.....
> $this->set(compact('variable'));
>
> On Nov 19, 12:30 am, jburns <[email protected]> wrote:
>
>
>
> > Once I have executed this...
>
> > $this->set('variable', $this->Controller->read(null, $id));
>
> > ...within the view function of a controller, how can I access the
> > contents of 'variable'? I want to extract one or more field values of
> > the current row. I have tried using $variable, but it is not
> > recognised.
--
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=.