TITAN Library for PHP5  5.1.0
Web Software Development Kit for PHP5
Example 2: "Add CSS & JavaScript"

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\format\html();
    $html->nocache();
    $html->title('Example 2');
    $css = array(
        '/css/reset.css',
        '/css/example.css',
    );
    $html->css($css);
    $html->css('/css/example_print.css', array('media' => 'print'));
    $js = array(
        '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js',
        '/js/jquery.tooltip.js',
    );
    $html->script($js);
    $html->body();
    $html->div("Hello, World!", array('class' => 'example'));
    $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 http-equiv="Expires" content="-1" />
  <meta http-equiv="Last-Modified" content="Thu, 01 Jan 1970 00:00:00 GMT" />
  <meta http-equiv="Cache-Control" content="no-cache, must-revalidate, post-check=0, pre-check=0" />
  <meta http-equiv="Cache-Control" content="public" />
  <meta http-equiv="Pragma" content="no-cache" />
  <meta charset="UTF-8">
  <title>Example 2</title>
  <link rel="Stylesheet" media="all" href="/css/reset.css"/>
  <link rel="Stylesheet" media="all" href="/css/example.css"/>
  <link rel="Stylesheet" media="print" href="/css/example_print.css"/>
  <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  <script type="text/javascript" src="/js/jquery.tooltip.js"></script>
 </head>

 <body>
  <div class="example">Hello, World!</div>
 </body>
</html>