Your SlideShare is downloading. ×
0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Bake by cake php2.0
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,652
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • 簡単にいえば、スキーマを参照してMVCのファイルを出力してくれるということです。\n
  • \n
  • \n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • これらを踏まえてbakeしてみます。\n
  • これらを踏まえてbakeしてみます。\n
  • \n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • ただし簡単なbakeはこれらのファイルを主に編集する\n
  • \n
  • \n
  • Transcript

    • 1. bake byCakePHP2.0 Bansystems Inc Yosuke Konno 1
    • 2. 2
    • 3. yeah! TEAM MontbancSucks ■ 1@konsan @mon_sat ※1: =CakePHP @hiromi2424 3
    • 4. bake bake bake bake search plugin 4
    • 5. bakeBake CakePHP Bake Bake 5
    • 6. bakeBake CakePHP Bake Bake --cookbook -- 5
    • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. search plugin bakesearch plugin debug kit bake 19
    • 21. bake githubgit://github.com/MontBlanc-Sucks/CakePHP-bootstrap-skel.git 20
    • 22. tipshare !tipshare 21

    ×