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' => false,
'wrapInput' => false
),
'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'
)); ?>
<?php echo $this->Form->submit('Submit', array(
'div' => false,
'class' => 'btn'
)); ?>
</fieldset>
<?php echo $this->Form->end(); ?>
Add .form-search to the form and .search-query to the <input> for an extra-rounded text input.
<?php echo $this->Form->create('BoostCake', array(
'inputDefaults' => array(
'div' => false,
'wrapInput' => false
),
'class' => 'well form-search'
)); ?>
<?php echo $this->Form->input('text', array(
'label' => false,
'class' => 'input-medium search-query',
)); ?>
<?php echo $this->Form->submit('Search', array(
'div' => false,
'class' => 'btn'
)); ?>
<?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' => false,
'label' => false,
'wrapInput' => false
),
'class' => 'well form-inline'
)); ?>
<?php echo $this->Form->input('email', array(
'class' => 'input-small',
'placeholder' => 'Email'
)); ?>
<?php echo $this->Form->input('password', array(
'class' => 'input-small',
'placeholder' => 'Password'
)); ?>
<?php echo $this->Form->input('remember', array(
'label' => array(
'text' => 'Remember me',
'class' => 'checkbox'
),
'checkboxDiv' => false
)); ?>
<?php echo $this->Form->submit('Sign in', array(
'div' => false,
'class' => 'btn'
)); ?>
<?php echo $this->Form->end(); ?>
Right align labels and float them to the left to make them appear on the same line as controls. Requires the most markup changes from a default form:
.form-horizontal to the form.control-group.control-label to the label.controls for proper alignment<?php echo $this->Form->create('BoostCake', array(
'inputDefaults' => array(
'div' => 'control-group',
'label' => array(
'class' => 'control-label'
),
'wrapInput' => 'controls'
),
'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(
'label' => 'Remember me',
'afterInput' => $this->Form->submit('Sign in', array(
'class' => 'btn'
))
)); ?>
<?php echo $this->Form->end(); ?>
<?php echo $this->Form->create('BoostCake', array(
'inputDefaults' => array(
'div' => 'control-group',
'label' => array(
'class' => 'control-label'
),
'wrapInput' => 'controls'
),
'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="control-label">Radio</label>',
'legend' => 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',
'div' => 'control-group',
'label' => array(
'text' => 'Prepend',
),
'beforeInput' => '<div class="input-prepend"><span class="add-on">@</span>',
'afterInput' => '</div>'
)); ?>
<?php echo $this->Form->input('price', array(
'label' => array(
'text' => 'Append',
),
'beforeInput' => '<div class="input-append">',
'afterInput' => '<span class="add-on">.00</span></div>'
)); ?>
<?php echo $this->Form->input('price_error', array(
'label' => array(
'text' => 'Append Error',
),
'beforeInput' => '<div class="input-append">',
'afterInput' => '<span class="add-on">.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(
'label' => array('class' => null),
'afterInput' => '<span class="help-block">Checkbox Bootstrap Style</span>'
)); ?>
<?php echo $this->Form->input('checkbox', array(
'div' => false,
'label' => false,
'before' => '<label class="control-label">Checkbox</label>',
'wrapInput' => 'controls',
'afterInput' => '<span class="help-block">Checkbox CakePHP Style</span>'
)); ?>
<div class="form-actions">
<?php echo $this->Form->submit('Save changes', array(
'div' => false,
'class' => 'btn btn-primary'
)); ?>
<button type="button" class="btn">Cancel</button>
</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( 'div' => 'pagination' )); ?>
Fancy larger or smaller pagination? Add .pagination-large,
.pagination-small, or .pagination-mini for additional sizes.
<?php echo $this->Paginator->pagination(array( 'div' => 'pagination pagination-large' )); ?> <?php echo $this->Paginator->pagination(array( 'div' => 'pagination' )); ?> <?php echo $this->Paginator->pagination(array( 'div' => 'pagination pagination-small' )); ?> <?php echo $this->Paginator->pagination(array( 'div' => 'pagination pagination-mini' )); ?>
Add one of two optional classes to change the alignment of pagination links:
.pagination-centered and .pagination-right.
<?php echo $this->Paginator->pagination(array( 'div' => 'pagination pagination-centered' )); ?> <?php echo $this->Paginator->pagination(array( 'div' => 'pagination pagination-right' )); ?>
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 notice message testing...'), 'alert', array(
'plugin' => 'BoostCake',
));
$this->Session->setFlash(__('Alert success message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-success'
));
$this->Session->setFlash(__('Alert error message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-error'
));
?>