On Mar 8, 2:43 pm, "nate" <[EMAIL PROTECTED]> wrote:
> Hey Y'all,
>
> We're putting together an official CakePHP FAQ.  So add your
> recommended frequently asked questions (and answers) 
> here:https://trac.cakephp.org/ticket/1576

Q. How do I create navigation / links based on the entries in a
database?
In the cats controller:
function navigation()
{
        $this->Cats->recursive = 0;
        $this->set('navdata', $this->Cats->findAll(null, array('name',
'id')));
        $this->render();
}

In the navigation.thtml:
<ul>
<?php foreach($navdata as $nav): ?>
<li><?php echo $html->link($nav['Cat']['name'], "/Cats/view/".
$nav['Cat']['id']); ?></li>
<?php
endforeach;
?>
</ul>

In the default.thtml:
$this->requestAction('/cats/navigation/');


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to