TITAN Library for PHP5  5.6.0
Web Software Development Kit for PHP5
Example 3: "Build a Table"

Table of Contents

PHP Source:

<?php
    $titan_library_path = '/path/to/titan/lib/';
    require_once $titan_library_path.'tl.core.init.php';

    $html = new \tl\output\html();
    $html->title('Example 3: Build a Table');
    $css = array(
        '/css/reset.css',
        '/css/example.css',
    );
    $html->css($css);
    $html->body();
    $html->table(array('class' => 'example'));
    $html->thead();
        $html->th('Header 1');
        $html->th('Header 2');
        $html->th('Header 3');
    $html->tbody();
        $html->td('Content 1-1');
        $html->td('Content 1-2');
        $html->td('Content 1-3');
    $html->tr();
        $html->td('Content 2-1');
        $html->td('Content 2-2');
        $html->td('Content 2-3');
    $html->complete();

Output:

<!DOCTYPE html>
<!-- TITAN Library for PHP5 Copyright 2013, Titan Integration [root@titan-integration.com], http://www.titan-integration.com/ -->
<html>
 <head>
  <meta charset="UTF-8">
  <title>Example 3: Build a Table</title>
  <link rel="Stylesheet" media="all" href="/css/reset.css"/>
  <link rel="Stylesheet" media="all" href="/css/example.css"/>
 </head>

 <body>
  <table class="example">
   <thead>
    <tr>
     <th>Header 1</th>
     <th>Header 2</th>
     <th>Header 3</th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>Content 1-1</td>
     <td>Content 1-2</td>
     <td>Content 1-3</td>
    </tr>
    <tr>
     <td>Content 2-1</td>
     <td>Content 2-2</td>
     <td>Content 2-3</td>
    </tr>
   </tbody>
  </table>
 </body>
</html>