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.
bake byCakePHP2.0   Bansystems Inc      Yosuke Konno         1
2
yeah!          TEAM MontbancSucks                                           ■                                             ...
bake          bake               bake       bake   search plugin                 4
bakeBake     CakePHP                   Bake                     Bake            5
bakeBake        CakePHP                           Bake                             Bake       --cookbook     --           ...
1.3:                  2.0:cake/console/         lib/Cake/Console/|-- cake              |-- Templates|-- cake.bat          ...
lib/Cake/Console/Templates/skel/       CakePHP-bootstrap-skel/|-- Config                              |-- README.textile|--...
lib/Cake/Console/Templates/default/|-- actions| `-- controller_actions.ctp|-- classes| |-- controller.ctp| |-- fixture.ctp ...
bake                demo  skel                     project bake1.create schema./lib/Cake/Console/cake schema create --file ...
bake     twitter bootstrap                                                skel bake                         <!DOCTYPE html...
default→TwitterBootstrap demoskel/Console/Templates/TwitterBootstrap/|-- actions| `-- controller_actions.ctp|-- classes| |...
search plugin bake→                git clonecd skel/Plugin/git clone git://github.com/cakephp/debug_kit.git -b 2.0 DebugKi...
search plugin bakevi skel/Console/Templates/TwitterBootstrap/actions/controller_actions.ctp  <?php  if ($modelObj) {      ...
search plugin bake  index action  public function <?php echo $admin ?>index() {    $this-><?php echo $currentModelName ?>-...
search plugin bakevi skel/Console/Templates/TwitterBootstrap/classes/model.ctp<?php   $modelObj = ClassRegistry::init($nam...
search plugin bakevi skel/Console/Templates/TwitterBootstrap/classes/model.ctp<?php   $modelObj = ClassRegistry::init($nam...
search plugin bake               index.ctp<div class="span16">     <div class="hero unit">            <?php echo "<?php ec...
search plugin bake                                                                                      demo    bake→bake ...
search plugin bakesearch plugin        debug kit    bake                19
bake                         githubgit://github.com/MontBlanc-Sucks/CakePHP-bootstrap-skel.git                         20
tipshare   !tipshare           21
Upcoming SlideShare
Loading in …5
×

Bake by cake php2.0

3,194 views

Published on

Published in: Technology, Self Improvement
  • Be the first to comment

Bake by cake php2.0

  1. 1. bake byCakePHP2.0 Bansystems Inc Yosuke Konno 1
  2. 2. 2
  3. 3. yeah! TEAM MontbancSucks ■ 1@konsan @mon_sat ※1: =CakePHP @hiromi2424 3
  4. 4. bake bake bake bake search plugin 4
  5. 5. bakeBake CakePHP Bake Bake 5
  6. 6. bakeBake CakePHP Bake Bake --cookbook -- 5
  7. 7. 1.3: 2.0:cake/console/ lib/Cake/Console/|-- cake |-- Templates|-- cake.bat | |-- default|-- cake.php | `-- skel|-- error.php |-- cake`-- templates |-- cake.bat |-- default `-- cake.php `-- skel 6
  8. 8. lib/Cake/Console/Templates/skel/ CakePHP-bootstrap-skel/|-- Config |-- README.textile|-- Console |-- bootstrap|-- Controller |-- initial|-- Lib | |-- AppSchema.php|-- Locale | `-- data|-- Model `-- skel|-- Plugin |-- Config|-- Test |-- Console|-- Vendor |-- Controller|-- View |-- Lib|-- index.php |-- Locale|-- tmp |-- Model`-- webroot |-- Plugin |-- Test |-- Vendor |-- View |-- index.php |-- tmp `-- webroot 7
  9. 9. lib/Cake/Console/Templates/default/|-- actions| `-- controller_actions.ctp|-- classes| |-- controller.ctp| |-- fixture.ctp bake| |-- model.ctp| `-- test.ctp`-- views |-- form.ctp |-- home.ctp |-- index.ctp `-- view.ctp 8
  10. 10. bake demo skel project bake1.create schema./lib/Cake/Console/cake schema create --file AppSchema.php2.database.php configskel/Config/|-- Schema|-- acl.ini.php|-- bootstrap.php|-- core.php|-- database.php|-- database.php.default|-- email.php.default`-- routes.php 9
  11. 11. bake twitter bootstrap skel bake <!DOCTYPE html> <html> <head> <?php echo $this->Html->charset(); ?> <title>skel/View/Layouts/ <?php echo __(CakePHP: the rapid development php framework:); ?> <?php echo $title_for_layout; ?>|-- Emails </title>|-- default.ctp <meta name="description" content="">|-- js <meta name="author" content=""> <?php|-- rss echo $this->Html->meta(icon);`-- xml echo $this->Html->css(array( http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css, cake.generic, main, )); ?> <script type="text/javascript" src="//www.google.com/jsapi"></script> <script type="text/javascript">google.load("jquery", "1.6.2");</script> <?php echo $this->Html->script(array( 10
  12. 12. default→TwitterBootstrap demoskel/Console/Templates/TwitterBootstrap/|-- actions| `-- controller_actions.ctp|-- classes| |-- controller.ctp| |-- fixture.ctp| |-- model.ctp| `-- test.ctp`-- views |-- form.ctp |-- home.ctp |-- index.ctp `-- view.ctp 11
  13. 13. search plugin bake→ git clonecd skel/Plugin/git clone git://github.com/cakephp/debug_kit.git -b 2.0 DebugKitgit clone git://github.com/CakeDC/search.git -b 2.0 Search※git submodule OK→pluginvi Config/bootstrap.phpCakePlugin::loadAll(); 12
  14. 14. search plugin bakevi skel/Console/Templates/TwitterBootstrap/actions/controller_actions.ctp <?php if ($modelObj) { $schema = $modelObj->schema(true); fields $fields = array_keys($schema); } else { $fields = $schema = $associations = array(); } ?> var $components = array(Search.Prg); var $presetVars = array( <?php foreach ($fields as $field):?> array(model=><?php echo $currentModelName ?>, field => <?phpecho $field?>, type => value), <?php endforeach;?> ); 13
  15. 15. search plugin bake index action public function <?php echo $admin ?>index() { $this-><?php echo $currentModelName ?>->recursive = 0; $this->set(<?php echo $pluralName ?>, $this->paginate()); } public function <?php echo $admin ?>index() { $this->Prg->commonProcess(); $this->paginate = array(conditions=>$this-><?php echo$currentModelName ?>->parseCriteria($this->passedArgs)); $this->set(<?php echo $pluralName ?>, $this->paginate()); } 14
  16. 16. search plugin bakevi skel/Console/Templates/TwitterBootstrap/classes/model.ctp<?php $modelObj = ClassRegistry::init($name); if ($modelObj) { $schema = $modelObj->schema(true); $fields = array_keys($schema); } else { fields $fields = $schema = $associations = array(); }?>/* search plugin*/ public $actsAs = array(Search.Searchable); public $filterArgs = array( <?php foreach ($fields as $field):?> array(name => <?php echo $field?>, type => like), <?php endforeach;?> ); 15
  17. 17. search plugin bakevi skel/Console/Templates/TwitterBootstrap/classes/model.ctp<?php $modelObj = ClassRegistry::init($name); if ($modelObj) { $schema = $modelObj->schema(true); $fields = array_keys($schema); } else { fields $fields = $schema = $associations = array(); }?>/* search plugin*/ public $actsAs = array(Search.Searchable); public $filterArgs = array( <?php foreach ($fields as $field):?> array(name => <?php echo $field?>, type => like), <?php endforeach;?> ); 16
  18. 18. search plugin bake index.ctp<div class="span16"> <div class="hero unit"> <?php echo "<?php echo $this->Form->create({$modelClass}, array(url =>array_merge(array(action => index), $this->params[pass])));?>n"; foreach ($fields as $field) { if (strpos($action, add) !== false && $field == $primaryKey) { continue; } elseif (!in_array($field, array(created, modified, updated, DateInputed,DateUpdated))) { echo "tt <?php echo $this->Form->input({$field});?>n"; } } echo "<?php echo $this->Form->submit(__(Search, true), array(div => false));?>n"; echo "<?php echo $this->Form->end();?>n"; ?> </div></div> 17
  19. 19. search plugin bake demo bake→bake project./lib/Cake/Console/cake bake project app --skel ../CakePHP-bootstrap-skel/skel --empty true→bake all./lib/Cake/Console/cake bake all 18
  20. 20. search plugin bakesearch plugin debug kit bake 19
  21. 21. bake githubgit://github.com/MontBlanc-Sucks/CakePHP-bootstrap-skel.git 20
  22. 22. tipshare !tipshare 21

×