Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cakephp2study tips集

2,343 views

Published on

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

  • Be the first to comment

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’));

×