2017 © Pedro Peláez
 

library html5

HTML5 Express is a library for creating HTML5 documents. It comes with the calendar trait.

image

clacy-builders/html5

HTML5 Express is a library for creating HTML5 documents. It comes with the calendar trait.

  • Friday, May 13, 2016
  • by clacy-builders
  • Repository
  • 1 Watchers
  • 2 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

HTML5 Express for PHP

Installation

HTML5 Express for PHP requires PHP 5.4 or newer., (*1)

Add the following to your project's composer.json file:, (*2)

{
    "minimum-stability": "dev",
    "require": {
        "clacy-builders/html5": "dev-master"
    }
}

Run composer install or composer update., (*3)

Without Composer

  1. Install XML Express for PHP
  2. Download the ZIP file.
  3. Inside your project directory create the directories /vendor/clacy-builders/html5.
  4. From the folder html5-express-php-master inside the ZIP file copy the files it contains into the previously created html5 folder.

Replace, (*4)

require_once 'vendor/autoload.php';

with, (*5)

require_once 'vendor/clacy-builders/html5/allIncl.php';

Basic Usage

An Example:, (*6)

<?php
require_once 'vendor/autoload.php';

use 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();

The generated markup:, (*7)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <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(0, 51, 102, 1);
                font-weight: normal;
            }
            tr {
                background-color: rgba(0, 51, 102, 0.2);
            }
            tr.every-2nd {
                background-color: rgba(0, 51, 102, 0.4);
            }
            table {
                border-width: 0;
                border-spacing: 0;
            }
        </style>
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>name</th>
                    <th>town</th>
                    <th>amount</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td rowspan="3">Foo</td>
                    <td rowspan="2">Berlin</td>
                    <td>20</td>
                </tr>
                <tr>
                    <td>12</td>
                </tr>
                <tr>
                    <td>Cologne</td>
                    <td>12</td>
                </tr>
                <tr class="every-2nd">
                    <td rowspan="3">Bar</td>
                    <td>Cologne</td>
                    <td>12</td>
                </tr>
                <tr class="every-2nd">
                    <td rowspan="2">Hamburg</td>
                    <td>15</td>
                </tr>
                <tr class="every-2nd">
                    <td>15</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

The Versions

13/05 2016

dev-master

9999999-dev

HTML5 Express is a library for creating HTML5 documents. It comes with the calendar trait.

  Sources   Download

MIT

The Requires

 

calendar html writer html5 builder

09/04 2016

0.1

0.1.0.0

HTML5 Express is a library for creating HTML5 documents. It comes with the calendar trait.

  Sources   Download

MIT

The Requires

 

calendar html writer html5 builder