I just found out that the Page Controller is being used by default when modifying the homepage of a new CakePHP installation. I read that this is mostly used for static pages. I’d like to make a static left-hand vertical navigation bar, but I’m not sure how I need to go about using other controllers from here, /cake.
This is really messy, as I’m trying to figure things out, but… for example, I have the Product Controller which allows me to do things with some products I have in the database via /cake/products. So, I made left-hand menu using $this->element('left_menu'), which includes the following (HTML code omitted) code, in C:\...\cake\app\views\pages\home.ctp.
<?php echo $this->Html->link(__('Product View', true), array('action' => 'products/view')); ?>
And I’m routing cake/page/products (from homepage) to Products Controller’s index page so I can use the Products Controller’s functionalities when this menu button is clicked.
Router::connect('/pages/products/*', array('controller' => 'products', 'action' => 'index'));
This left navi menu works from the homepage, but once I click on this menu button and go to /cake/product/..., it no longer works because it is relative to the Page Controller. How do I go about making this static left navigation bar to allow me to use other controllers? Eventually, I’d like this static menu to take me to use functions of other controllers as well. I’m so confused!
Regarding having the menu in place, you’ll want to make sure you’re putting all your menu stuff in your app/View/Layouts/default.ctp file.
And while you’re on that page I linked, look into the HTML helper and having it generate your links for you. Saves tons of time.