Natan Felles


Creative Webmaster


PHPBS - PHP Bootstrap Helpers

Blog · desenvolvimento · projetos

PHPBS - PHP Bootstrap Helpers

<?= table(
	['ID', 'Title', 'Actions'],
	[
		[1, 'Post 1', btn(icon('pencil'), ['sm'], ['href' => '/posts/1/edit']) . btn_danger(icon('times'))],
		[2, 'Post 2', btn(icon('pencil'), ['sm'], ['href' => '/posts/2/edit']) . btn_danger(icon('times'))]
	],
	['bordered', 'hover', 'striped'],
	[pagination(2, 20) => ['colspan' => 3, 'class' => 'text-center']],
	['id' => 'posts-table']
) ?>
<table class="table table-bordered table-hover table-striped" id="posts-table">
	<thead>
		<tr>
			<th>ID</th>
			<th>Title</th>
			<th>Action</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>1</td>
			<td>Post 1</td>
			<td>
				<a class="btn btn-default btn-sm" href="/posts/1/edit">
					<i class="glyphicon glyphicon-pecil"></i>
				</a>
				<button class="btn btn-danger" type="button">
					<i class="glyphicon glyphicon-times"></i>
				</button>
			</td>
		</tr>
		<tr>
			<td>2</td>
			<td>Post 2</td>
			<td>
				<a class="btn btn-default btn-sm" href="/posts/2/edit">
					<i class="glyphicon glyphicon-pecil"></i>
				</a>
				<button class="btn btn-danger" type="button">
					<i class="glyphicon glyphicon-times"></i>
				</button>
			</td>
		</tr>
	</tbody>
	<tfoot>
		<tr>
			<td class="text-center" colspan="3">
				<ul class="pagination">
					<li class="active"><a>1</a></li>
					<li><a href="/posts?page=2">2</a></li>
					<li><a href="/posts?page=3">3</a></li>
					<li><a href="/posts?page=4">4</a></li>
					<li><a href="/posts?page=2"><span aria-hidden="true">&raquo;</span></a></li>
					<li><a href="/posts?page=10">Last</a></li>
				</ul>
			</td>
		</tr>
	</tfoot>
</table>