GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Monday, April 4, 2011

CakePHP - Creating Layout

Layout is a part of presentation side of CakePHP. Just copy the default.ctp in cake/libs/view/layouts/default.ctp to app/views/layout/default.ctp
The customize it:
1. Loading title:
<?php echo $title_for_layout;?>
2. Loading content
<?php echo $content_for_layout;?>
3. Loading css file that lies on webroot/css/some.css
<?php echo $html->css('filname_without_extenstion');?>
4. Loading javascript file that lies on webroot/js/some.js
    a. In controller file, add var $helpers = array('Javascript');
    b. In the layout, add <?php echo $javascript->link('filename_without_ext');?>
Share/Bookmark

No comments:

Post a Comment