CakePHP2.5.1でBoostCakeプラグイン
はじめに
準備できたので画面つくってみる。
http://ikechampion.hatenablog.com/entry/2014/05/29/120300
cssなど変更
/app/View/Layouts/default.php
echo $this->Html->css('cake.generic');
を下記に変更
echo $this->Html->script('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'); echo $this->Html->css('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css'); echo $this->Html->script('//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js');
サンプル
/app/Controller/ExampleController.php
<?php class ExampleController extends AppController { public function index() { } }
/app/View/Example/index.ctp
<?php echo $this->Form->create('BoostCake', array( 'inputDefaults' => array( 'div' => 'form-group', 'wrapInput' => false, 'class' => 'form-control' ), 'class' => 'well' )); ?> <fieldset> <legend>Legend</legend> <?php echo $this->Form->input('text', array( 'label' => 'Label name', 'placeholder' => 'Type something…', 'after' => '<span class="help-block">Example block-level help text here.</span>' )); ?> <?php echo $this->Form->input('checkbox', array( 'label' => 'Check me out', 'class' => false )); ?> <?php echo $this->Form->submit('Submit', array( 'div' => 'form-group', 'class' => 'btn btn-default' )); ?> </fieldset> <?php echo $this->Form->end(); ?>