Rapid Application Development with Open Source Software

Next: CakePHP upload Images UP: TOC

The are some information on the views which appear several times. Those elements should be developed once and reused. In our book the navigation appears in the top on in the bottom of the page.

First we create a file for the chapter navigation with the name "ChapterNavigation.ctp"

vi /usr/local/www/logikfabrik.com/cakephp/app/View/Elements/ChapterNavigation.ctp

The content of "ChapterNavigation.ctp" is as follows


';

if (!empty($chapter[0][0]['prev_title'])) {
  echo '';
  echo ' ' . $chapter[0][0]['prev_title'] . '';
}

echo '';
echo ' TOC'  . ' ';


if (!empty($chapter[0][0]['next_title'])) {
  echo '';
  echo $chapter[0][0]['next_title'] . ' ';
}
echo '
'; Next: CakePHP upload Images UP: TOC