PHP code example of bootpress / table

1. Go to this page and download the library: Download bootpress/table 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 / table example snippets




use BootPress\Table\Component as Table;

$table = new Table;

$html = $table->open();
    $html .= $table->row();
    $html .= $table->cell('', 'One');
    $html .= $table->cell('', 'Two');
    $html .= $table->cell('', 'Three');
$html .= $table->close();

echo $html;

$html = $table->open('border=1|class=special');
    $html .= $table->row();
    $html .= $table->cell('rowspan=2', 'Two Rows');
    $html .= $table->cell('', 'One');
    $html .= $table->cell('', 'Two');
    $html .= $table->row();
    $html .= $table->cell('colspan=2', 'Buckle my shoe');
$html .= $table->close();

echo $html;

$html = $table->open('border=1', 'Caption');
    $html .= $table->head();
    $html .= $table->cell('colspan=2') . 'Header';
    $html .= $table->row();
    $html .= $table->cell() . 'Three';
    $html .= $table->cell() . 'Four';
    $html .= $table->foot();
    $html .= $table->cell('colspan=2') . 'Shut the door';
$html .= $table->close();

echo $html;

$t1 = new Table;
$t2 = new Table;

$html = $t1->open();
    $html .= $t1->row();
    $html .= $t1->cell('', 'Five');
    $html .= $t1->cell() . 'Six';
    $html .= $t1->cell();
        $html .= $t2->open('border=1');
            $html .= $t2->row();
            $html .= $t2->cell('', 'Pick');
            $html .= $t2->cell('', 'Up');
            $html .= $t2->cell('', 'Sticks');
        $html .= $t2->close();
$html .= $t1->close();