PHP code example of clacy-builders / html5
1. Go to this page and download the library: Download clacy-builders/html5 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/ */
clacy-builders / html5 example snippets
ClacyBuilders\Html5\Html5;
$dbRows = [
['id' => 42, 'name' => 'Foo', 'town' => 'Berlin', 'amount' => 20],
['id' => 43, 'name' => 'Foo', 'town' => 'Berlin', 'amount' => 12],
['id' => 50, 'name' => 'Foo', 'town' => 'Cologne', 'amount' => 12],
['id' => 51, 'name' => 'Bar', 'town' => 'Cologne', 'amount' => 12],
['id' => 68, 'name' => 'Bar', 'town' => 'Hamburg', 'amount' => 15],
['id' => 69, 'name' => 'Bar', 'town' => 'Hamburg', 'amount' => 15]
];
$bgColor = '0, 51, 102';
$html = Html5::createHtml();
$head = $html->head();
$head->style("body, * {
font-family: open sans, tahoma, verdana, sans-serif;
}
td, th {
text-align: left;
vertical-align: text-top;
padding: 0.5em;
}
td:last-child {
text-align: right;
}
th {
color: white;
background-color: rgba($bgColor, 1);
font-weight: normal;
}
tr {
background-color: rgba($bgColor, 0.2);
}
tr.every-2nd {
background-color: rgba($bgColor, 0.4);
}
table {
border-width: 0;
border-spacing: 0;
}");
$body = $html->body();
$table = $body->table();
$table->thead()->trow(['name', 'town', 'amount'], null, true);
$table->tbody()
->trows($dbRows, ['name', 'town', 'amount'])
->stripes([null, 'every-2nd'], 0)
->rowspans();
print $html->getMarkup();