Hello, I know this topic has been discussed several times, but I'm not
able to find the solution for my problem so I'll try to explain it.
I need a navigation menu for my CakePHP application, I have chosen to
use a css+javascritp menu, so I have added the css+javascript files to
it locations and I load them in the layout using:
<?php echo $html->css('menu');?>
<?php print $javascript->link('menu') ?>

Finally I render the element:
<?php echo $this->renderElement('menu'); ?>

If I try to use a "static" menu it works perfectly, but my problem
comes out when I try to add the menu items from the database.
For this purpose I have add a new function to one of my controller
(dirtab_ts_controller):

  function listado(){
        $conditions = "acttabla=1";
        $data = $this->DirtabT->findAll($conditions);
        $this->set("dirtabTs", $data); // data
    }

So in the Element I have add:
<?php
$this->requestAction('/dirtab_ts/listado');
?>
To get the data and:
<?php foreach ($dirtabTs as $dirtabT): ?>
                                        <li><?php echo 
$dirtabT['DirtabT']['nomtabla']; ?></a></li>
<?php endforeach; ?>

to show it.

The menu shows this error:

Notice: Undefined variable: dirtabTs in
.....app\views\elements\menu.thtml on line 12

Warning: Invalid argument supplied for foreach() in
......app\views\elements\menu.thtml on line 12

It has to be something very simple, but I'm a bit lost.

Thanks in advance.

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