I tried this solution and whaddya know: if worked! here's my code.
//invoke menu element
<?php echo $this->renderElement('menu'); ?>

//menu.thtml
<ul>
<?php
        $controls = $this->requestAction('controls/navindex');
        foreach($controls as $control) {
                print "<li>";
                if ($control['Control']['path'] == $this->here){
                        echo 
$html->link($control['Control']['name'],$control['Control']
['path'],'class="active"');
                }else{
                        echo 
$html->link($control['Control']['name'],$control['Control']
['path']);
                }
                print "</li>";
        }
?>
</ul>

On Mar 19, 5:19 pm, "gwoo" <[EMAIL PROTECTED]> wrote:
> This has come up a lot lately for some reason. I guess because there
> are not enough examples.
>
> Personally, I would setup and element. Lets calll it /app/views/
> elements/menu.thtml
> add to this:
>
> $controls = $this->requestAction('controls/index');
> foreach($controls as $control) {
> //do whatever}
>
> very simply this asks the controls controller to return the index
> method so you can display the data however you want
>
> <?php
> class ContolsController extends AppController {
>
> function index() {
>
>     $contols = $this->Control->findAll();
>
>     //here is where the requesAction is handled so only the data is
> returned
>     if(isset($this->params['requested'])) {
>         return $controls;
>     }
>
>     $this->set('controls', $controls);
>
> }
> }
>
> ?>


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to