Individual form controls receive styling, but without any required base class on the <form>
or large changes in markup. Results in stacked, left-aligned labels on top of form controls.
<?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(); ?>
Add .form-inline
for left-aligned labels and inline-block controls for a compact layout.
<?php echo $this->Form->create('BoostCake', array( 'inputDefaults' => array( 'div' => 'form-group', 'label' => false, 'wrapInput' => false, 'class' => 'form-control' ), 'class' => 'well form-inline' )); ?> <?php echo $this->Form->input('email', array( 'placeholder' => 'Email' )); ?> <?php echo $this->Form->input('password', array( 'placeholder' => 'Password' )); ?> <?php echo $this->Form->input('remember', array( 'div' => 'checkbox', 'class' => false, 'label' => 'Remember me' )); ?> <?php echo $this->Form->submit('Sign in', array( 'div' => 'form-group', 'class' => 'btn btn-default' )); ?> <?php echo $this->Form->end(); ?>
Use Bootstrap's predefined grid classes to align labels and groups of form controls in a horizontal layout.
<?php echo $this->Form->create('BoostCake', array( 'inputDefaults' => array( 'div' => 'form-group', 'label' => array( 'class' => 'col col-md-3 control-label' ), 'wrapInput' => 'col col-md-9', 'class' => 'form-control' ), 'class' => 'well form-horizontal' )); ?> <?php echo $this->Form->input('email', array( 'placeholder' => 'Email' )); ?> <?php echo $this->Form->input('password', array( 'placeholder' => 'Password' )); ?> <?php echo $this->Form->input('remember', array( 'wrapInput' => 'col col-md-9 col-md-offset-3', 'label' => 'Remember me', 'class' => false )); ?> <div class="form-group"> <?php echo $this->Form->submit('Sign in', array( 'div' => 'col col-md-9 col-md-offset-3', 'class' => 'btn btn-default' )); ?> </div> <?php echo $this->Form->end(); ?>
<?php echo $this->Form->create('BoostCake', array( 'inputDefaults' => array( 'div' => 'form-group', 'label' => array( 'class' => 'col col-md-3 control-label' ), 'wrapInput' => 'col col-md-9', 'class' => 'form-control' ), 'class' => 'well form-horizontal' )); ?> <?php echo $this->Form->input('select', array( 'label' => array( 'text' => 'Select Nested Options' ), 'empty' => '選択してください', 'options' => array( '東京' => array( 1 => '渋谷', 2 => '秋葉原' ), '大阪' => array( 3 => '梅田', 4 => '難波' ) ), )); ?> <?php echo $this->Form->input('select', array( 'label' => array( 'text' => 'Select Nested Options Checkbox' ), 'class' => 'checkbox-inline', 'multiple' => 'checkbox', 'options' => array( '東京' => array( 1 => '渋谷', 2 => '秋葉原' ), '大阪' => array( 3 => '梅田', 4 => '難波' ) ) )); ?> <?php echo $this->Form->input('radio', array( 'type' => 'radio', 'before' => '<label class="col col-md-3 control-label">Radio</label>', 'legend' => false, 'class' => false, 'options' => array( 1 => 'Option one is this and that—be sure to include why it\'s great', 2 => 'Option two can be something else and selecting it will deselect option one' ) )); ?> <?php echo $this->Form->input('username', array( 'placeholder' => 'Username', 'label' => array( 'text' => 'Prepend', ), 'beforeInput' => '<div class="input-group"><span class="input-group-addon">@</span>', 'afterInput' => '</div>' )); ?> <?php echo $this->Form->input('price', array( 'label' => array( 'text' => 'Append', ), 'beforeInput' => '<div class="input-group">', 'afterInput' => '<span class="input-group-addon">.00</span></div>' )); ?> <?php echo $this->Form->input('price_error', array( 'label' => array( 'text' => 'Append Error', ), 'beforeInput' => '<div class="input-group">', 'afterInput' => '<span class="input-group-addon">.00</span></div>' )); ?> <?php echo $this->Form->input('password', array( 'label' => array( 'text' => 'Show Error Message' ), 'placeholder' => 'Password' )); ?> <?php echo $this->Form->input('password', array( 'label' => array( 'text' => 'Hide Error Message' ), 'placeholder' => 'Password', 'errorMessage' => false )); ?> <?php echo $this->Form->input('checkbox', array( 'wrapInput' => 'col col-md-9 col-md-offset-3', 'label' => array('class' => null), 'class' => false, 'afterInput' => '<span class="help-block">Checkbox Bootstrap Style</span>' )); ?> <?php echo $this->Form->input('checkbox', array( 'before' => '<label class="col col-md-3 control-label">Checkbox</label>', 'label' => false, 'class' => false, 'afterInput' => '<span class="help-block">Checkbox CakePHP Style</span>' )); ?> <div class="form-group"> <div class="col col-md-9 col-md-offset-3"> <?php echo $this->Form->submit('Save changes', array( 'div' => false, 'class' => 'btn btn-primary' )); ?> <button type="button" class="btn btn-default">Cancel</button> </div> </div> <?php echo $this->Form->end(); ?>
Simple pagination inspired by Rdio, great for apps and search results. The large block is hard to miss, easily scalable, and provides large click areas.
<?php echo $this->Paginator->pagination(array( 'ul' => 'pagination' )); ?>
Fancy larger or smaller pagination? Add .pagination-lg,
.pagination-sm
, or .pagination-mini
for additional sizes.
<?php echo $this->Paginator->pagination(array( 'ul' => 'pagination pagination-lg' )); ?> <?php echo $this->Paginator->pagination(array( 'ul' => 'pagination' )); ?> <?php echo $this->Paginator->pagination(array( 'ul' => 'pagination pagination-sm' )); ?>
Quick previous and next links for simple pagination implementations with light markup and styles. It's great for simple sites like blogs or magazines.
<?php echo $this->Paginator->pager(); ?> <?php echo $this->Paginator->pager(array( 'prev' => '← Older', 'next' => 'Newer →' )); ?>
<?php // View echo $this->Session->flash(); // Controller $this->Session->setFlash(__('Alert success message testing...'), 'alert', array( 'plugin' => 'BoostCake', 'class' => 'alert-success' )); $this->Session->setFlash(__('Alert info message testing...'), 'alert', array( 'plugin' => 'BoostCake', 'class' => 'alert-info' )); $this->Session->setFlash(__('Alert warning message testing...'), 'alert', array( 'plugin' => 'BoostCake', 'class' => 'alert-warning' )); $this->Session->setFlash(__('Alert danger message testing...'), 'alert', array( 'plugin' => 'BoostCake', 'class' => 'alert-danger' )); ?>