PHP code example of bootpress / bootstrap
1. Go to this page and download the library: Download bootpress/bootstrap library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bootpress / bootstrap example snippets
use BootPress\Bootstrap\v3\Component as Bootstrap;
$bp = new Bootstrap;
// Use in your BootPress Blog's Twig templates as well:
$blog = new \BootPress\Blog\Component();
$blog->theme->vars['bp'] = $bp;
echo $bp->row('sm', array(
$bp->col(3, 'left'),
$bp->col(6, 'center'),
$bp->col(3, 'right'),
));
echo $bp->row('sm', 'md', 'lg', array(
$bp->col(12, '9 push-3', '10 push-2', 'content'),
$bp->col('6 offset-3 clearfix', '3 pull-9', '2 pull-10', 'sidebar'),
));
echo $bp->lister('ol', array(
'Coffee',
'Tea' => array(
'Black tea',
'Green tea',
),
'Milk',
));
echo $bp->lister('ul list-inline', array(
'Coffee',
'Tea',
'Milk',
));
echo $bp->lister('dl dl-horizontal', array(
'Coffee' => array(
'Black hot drink',
'Caffeinated beverage',
),
'Milk' => 'White cold drink',
));
echo $bp->table->open('class=responsive striped');
echo $bp->table->head();
echo $bp->table->cell('', 'One');
echo $bp->table->row();
echo $bp->table->cell('', 'Two');
echo $bp->table->foot();
echo $bp->table->cell('', 'Three');
echo $bp->table->close();
$form = $bp->form('sign_in');
$form->menu('remember', array('Y' => 'Remember me'));
$form->validator->set(array(
'email' => ' {
$form->message('info', 'Good job, you are doing great!');
$form->eject();
}
$form->size('lg'); // oversize the inputs
$form->align('collapse'); // default is horizontal
echo $form->header();
echo $form->fieldset('Sign In', array(
$form->field('Email address', $form->group($bp->icon('user'), '', $form->text('email'))),
$form->field('Password', $form->group($bp->icon('lock'), '', $form->password('password'))),
$form->field('', $form->checkbox('remember'),
$form->submit(),
));
echo $form->close();
echo $bp->button('primary', 'Primary');
echo $bp->button('lg success', 'Link', array('href'=>'#'));
echo $bp->button('link', 'Button');
echo $bp->button('default', 'Dropdown', array(
'dropdown' => array(
'Header',
'Action' => '#',
'Another action' => '#',
'Active link' => '#',
'',
'Separated link' => '#',
'Disabled link' => '#',
),
'active' => 'Active link',
'disabled' => 'Disabled link',
));
echo $bp->group('', array(
$bp->button('default', 'Left'),
$bp->button('default', 'Middle'),
$bp->button('default', array('split'=>'Right'), array(
'dropdown' => array(
'Works' => '#',
'Here' => '#',
'Too' => '#',
),
'pull'=>'right',
)),
));
echo $bp->tabs(array(
'Nav' => '#',
'Tabs' => '#',
'Justified' => '#',
), array(
'align' => 'justified',
'active' => 1,
));
echo $bp->pills(array(
'Home ' . $bp->badge(42) => '#',
'Profile' . $bp->badge(0) => '#',
'Messages' . $bp->badge(3) => array(
'New! ' . $bp->badge(1) => '#',
'Read ' => '#',
'Trashed ' => '#',
'',
'Spam ' . $bp->badge(2) => '#',
),
), array(
'active' => 'Home',
));
echo $bp->navbar->open(array('Website' => 'http://example.com'));
echo $bp->navbar->menu(array(
'Home' => '#',
'Work' => '#',
'Dropdown' => array(
'Action' => '#',
'More' => '#',
),
), array(
'active' => 'Home',
));
echo $bp->navbar->button('primary', 'Sign In', array(
'pull' => 'right',
));
echo $bp->navbar->search('http://example.com', array(
'button' => false,
));
echo $bp->navbar->close();
$bp->breadcrumbs(array(
'Home' => '#',
'Library' => '#',
'Data' => '#',
));
$records = range(1, 100);
if (!$bp->pagination->set('page', 10, 'http://example.com')) {
$bp->pagination->total(count($records));
}
echo $pagination->links();
echo $pagination->pager();
echo $bp->label('default', 'New');
echo $bp->badge(13, 'right');
echo $bp->alert('info', '<h3>Heads up!</h3> This alert needs your attention, but it\'s not <a href="#">super important</a>.');
echo $bp->alert('danger', '<h3>Oh snap!</h3> Change a few things up and <a href="#">try submitting again</a>.', false);
echo $bp->progress(60, 'info', 'display');
echo $bp->progress(array(25, 25, 25, 25), array('', 'warning', 'success', 'danger striped'));
echo $bp->media(array(
'Image',
'<h1>Parent</h1> <p>Paragraph</p>',
'<img src="parent.jpg" alt="Family Photo">',
array(
'Image',
'<h2>1st Child</h2>',
array(
'Image',
'<h3>1st Grandchild</h3>',
),
),
array(
'Image',
'<h2>2nd Child</h2>',
),
), array(
'class' => 'spoiled',
'Image',
'<h1>Sibling</h1> <a href="#">Link</a>',
'<img src="sibling.jpg" alt="Family Photo">',
));
$bp->listGroup(array(
'Basic',
'List',
$bp->badge(1) . ' Group',
));
$bp->listGroup(array(
'Linked' => '#',
'List' => '#',
'Group ' . $bp->badge(2) => '#',
), 'Linked');
$bp->listGroup(array(
'<h4>Custom</h4> <p>List</p>' => '#',
$bp->badge(3) . ' <h4>Group</h4> <p>Linked</p>' => '#',
), 1);
echo $bp->panel('primary', array(
'header' => '<h3>Title</h3>',
'body' => 'Content',
'footer' => '<a href="#">Link</a>',
));
echo $bp->panel('default', array(
'header': 'List group',
$bp->listGroup(array(
'One',
'Two',
'Three',
)),
));
echo $bp->toggle('tabs', array(
'Home' => 'One',
'Profile' => 'Two',
'Dropdown' => array(
'This' => 'Three',
'That' => 'Four',
),
), array(
'active' => 'This',
'fade',
));
echo $bp->accordion('info', array(
'<h4>Group Item #1</h4>' => 'One',
'<h4>Group Item #2</h4>' => 'Two',
'<h4>Group Item #3</h4>' => 'Three',
), 2);
echo '<div style="width:500px; height:300px; margin:20px auto;">';
echo $bp->carousel(array(
'<img src="http://lorempixel.com/500/300/food/1/" width="500" height="300">',
'<img src="http://lorempixel.com/500/300/food/2/" width="500" height="300">' => '<p>Caption</p>',
'<img src="http://lorempixel.com/500/300/food/3/" width="500" height="300">' => '<h3>Header</h3>',
), array(
'interval' => 3000,
));
echo '</div>';