PHP Classes

File: examples/example01.php

Recommend this page to a friend!
  Classes of Oliver Lillie  >  PHP Custom Tags  >  examples/example01.php  >  Download  
File: examples/example01.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Custom Tags
Template engine based on tags similar to HTML
Author: By
Last change: reorganized for composer support
Date: 2 years ago
Size: 1,755 bytes


Class file image Download

namespace CustomTags;

ini_set('error_reporting', E_ALL);
ini_set('track_errors', '1');
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
$current_dir = dirname(__FILE__).DIRECTORY_SEPARATOR;

$ct = new CustomTags(array(
'parse_on_shutdown' => true,
'tag_directory' => $current_dir.'tags'.DIRECTORY_SEPARATOR,
'sniff_for_buried_tags' => true
?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"

<html lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Custom Tags - Example 1</title>
    <meta name="author" content="Oliver Lillie">
    <!-- Date: 2008-09-04 -->
    <ct:header example_name="Simple Example" />
    This is text that is unaffected by the tags as it is outside the tag scope.<br />
    <br />
    <strong>ct:entities</strong><br />
        <strong>This is the <span="color:#ff0000;">ct:entities</span> tag.</strong><br />
        <strong>This is the <em>ct:entities</em> tag.</strong><br />
    </ct:entities><br />
    <br />
    <strong>ct:upper</strong><br />
    <ct:upper type="all">
        This text is transformed by the custom tag.<br />
        Using the default example all the characters should be made into uppercase characters.<br />
        Try changing the type attribute to 'ucwords' or 'ucfirst'.<br />
        <br />
            <strong>ct:lower</strong><br />
            THIS IS LOWERCASE TEXT TRANSFORMED BY THE ct:lower CUSTOM TAG even though it's inside the ct:upper tag.<br />
            <BR />
    <ct:analytics account="google-analytics-account-id" template="google" />