Cakephp2study tips集

2,183 views
2,112 views

Published on

2011年10月6日(木)CakePHP2.0勉強会LTの資料

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,183
On SlideShare
0
From Embeds
0
Number of Embeds
43
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Cakephp2study tips集

    1. 1. CakePHP1.3 CakePHP2.0(beta-)
    2. 2. require CAKE . Config . DS . routes.php;// Router::connect(/:controller, array(action => index));// Router::connect(/:controller/:action/*);
    3. 3. public $validate = array( title => array( between => array( rule => array(between, 10, 100), message => The title must havebetween %d to %d characters, ), ),);
    4. 4. $this->request ->data(Post.title, New post) ->data(Comment.1.author, Mark);
    5. 5. CakePlugin::loadAll();Configure::load(Site); // load ./Site.php Configure::config(default, ...);
    6. 6. # AnyController.phpvar $paginate = array( paramType => querystring);
    7. 7. # AnyController.php (default=100)var $paginate = array(maxLimit => 10);
    8. 8. # view.ctp<!--nocache--> <?php echo CakeSession::read(‘Auth.user.username’) ?><!--/nocache-->
    9. 9. CakeSession::check(‘Auth.user’);$this->Session->setFlash(); // Controller$this->Session->flash(); // View
    10. 10. $this->_View->viewVars[foo] === ‘tipshare’$this->_View-> set(title_for_layout, ‘tipshare’);mb_convert_encoding( $this->_View->output, ‘SJIS’, ‘UTF-8’);
    11. 11. $this->Form->postLink( ‘delete’, array(‘action’ => ‘delete’));$this->Form->postButton( ‘like’, array(‘action’ => ‘like’));

    ×