Categories
Archives
Pages
My Tweet
- 電車のつり革にRarejobの広告が。今年当たりからオンライン英会話の普及が加速するか。 http://t.co/tbFEuMAV 2 days ago
- 勉強になったな〜。感謝です。 1 week ago
- 西武線の英語アナウンスで一カ所早すぎて聞き取れない箇所があって気になっていたんだが、こんなとこまで記事にしてくれた方が。 自動放送 西武線 http://t.co/99VsMAy2 2 weeks ago
- More updates...
Posting tweet...
Powered by Twitter Tools
Friend Links
[CakePHP]How to create navigation with well thought out about current page
Using layout template is general at cakephp view. There is a global menu in layout template. If we show the selected global menu in each page even if it takes time a bit, it looks neat as the example below which I found at Google group.
<?php $navLinks = array( 'home' => array( 'title' => 'home', 'path' => '/', ), 'services' => array( 'title' => 'our services', 'path' => '/pages/services', ), 'contact' => array( 'title' => 'contact us', 'path' => '/contacts', ), 'about' => array( 'title' => 'about us', 'path' => '/pages/about', ), ); ?> <ul id="global_nav"> <?php foreach ($navLinks as $key => $link) : $class = null; if (strpos($this->params['url']['url'], substr($link['path'], 1)) !== false) { $class = array('class' => 'current'); } ?> <li id="nav_<?=$key?>"><?=$html->link($link['title'], $link['path'], $class)?></li> <?php endforeach; ?> </ul>