Home > cakePHP, PHP > PHP – cakePHP understand

PHP – cakePHP understand

Target: Understanding its framework and basic view & controllers

1. controller codes:

// /shamun/login or shamun/index
class ShamunController extends AppController {
// Still no idea
//var $name = “Shamun”;

// No database table to search
var $uses = null;

// goto view > /shamun/
function index(){
$this->layout = ‘nomenu’;

// goto view > /shamun/login
function login(){
$this->layout = ‘nomenu’;


2. views codes:

layouts >
… header….
echo $content_for_layout;
,.. footer

echo $content_for_layout;

page >

shamun >

I am a login page: view (i will be overwrite on $content_for_layout).


3. visit : http://localhost/cakephp/shamun
brings… nomenu.ctp with “shamun/index.ctp”

4. visit: http://localhost/cakephp/shamun/login

brings.. nomenu.ctp with “shamun/login.ctp”

Categories: cakePHP, PHP
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: