I think i know what you mean jet. There have actually been quite a few
articles written on the dangers of using requestAction. If I am going
to be using something like you are using, what I will usually do is
set up a function in app_controller that imports the Category model,
does a find('all') on that Category model and then sets the variable
$this->set('categories',$categories). If you don't want it on every
controller action, then you could set up an array of controllers and
actions where the function should run and then just set that up in the
beforeFilter function of the app_controller..

$controllerArray = array('Category'=>array('index'));

if(isset($controllerArray[$this->name][$this->action]){ $this-
>_setUpCategoriesNav(); }

On Nov 14, 12:14 pm, brian <[EMAIL PROTECTED]> wrote:
> Set the sub-category in the controller:
>
> $this->set('sub_category', ...
>
> then, in your element:
>
> $this->requestAction("category/index/${sub_category}");
>
> However, I'm not certain that I understand what you want to do, so there may
> be a better way to achieve your goal. Specifically, I don't understand why
> you want to call the index() method here. If you use the above example, your
> method will expect a parameter for sub_category. For example:
>
> $this->requestAction("category/foo/${sub_category}");
>
> In the controller:
>
> function foo($bar)
> {
>     return $bar;
>
> }
> On Thu, Nov 13, 2008 at 11:50 PM, jet wong <[EMAIL PROTECTED]> wrote:
>
> > I want to show the subcategory in every product page,so I  create a
> > element to do this,but I found the only method to get data is
> > requestAction, for example  I use $this->requestAction('category/
> > index/
> > mp3') to get the mp3 category, my question is how to change the param
> > 'mp3' to 'cd',Passing from controller?
> > please give some advice,I'm very thankful.sorry for my poor english.
>
>
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to