This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DATABASE_CONFIG { | |
var $default = array( | |
'driver' => 'mysql', | |
'persistent' => false, | |
'host' => 'localhost', | |
'login' => 'user', | |
'password' => 'pass', | |
'database' => 'workshop', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PostsController extends AppController { | |
var $name = 'Posts'; | |
var $helpers = array('Html', 'Form'); | |
function index() { | |
$this->Post->recursive = 0; | |
$this->set('posts', $this->paginate()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="posts index"> | |
<h2><?php __('Posts');?></h2> | |
<p> | |
<?php | |
echo $paginator->counter(array( | |
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) | |
)); | |
?></p> | |
<table cellpadding="0" cellspacing="0"> | |
<tr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="posts view"> | |
<h2><?php __('Post');?></h2> | |
<dl><?php $i = 0; $class = ' class="altrow"';?> | |
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt> | |
<dd<?php if ($i++ % 2 == 0) echo $class;?>> | |
<?php echo $post['Post']['id']; ?> | |
| |
</dd> | |
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Title'); ?></dt> | |
<dd<?php if ($i++ % 2 == 0) echo $class;?>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="posts form"> | |
<?php echo $form->create('Post');?> | |
<fieldset> | |
<legend><?php __('Add Post');?></legend> | |
<?php | |
echo $form->input('title'); | |
echo $form->input('body'); | |
?> | |
</fieldset> | |
<?php echo $form->end('Submit');?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="posts form"> | |
<?php echo $form->create('Post');?> | |
<fieldset> | |
<legend><?php __('Edit Post');?></legend> | |
<?php | |
echo $form->input('id'); | |
echo $form->input('title'); | |
echo $form->input('body'); | |
?> | |
</fieldset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppController extends Controller { | |
var $components = array('DebugKit.Toolbar'); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- テーブルの構造 `users` | |
-- | |
CREATE TABLE `users` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`username` varchar(20) COLLATE utf8_unicode_ci NOT NULL, | |
`password` char(40) COLLATE utf8_unicode_ci NOT NULL, | |
`created` datetime DEFAULT NULL, | |
PRIMARY KEY (`id`), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE `posts` ADD `user_id` INT NOT NULL AFTER `id`, ADD INDEX (`user_id`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User extends AppModel { | |
var $name = 'User'; | |
var $validate = array( | |
'username' => array('notempty'), | |
'password' => array('notempty') | |
); | |
//The Associations below have been created with all possible keys, those that are not needed can be removed |