PHP Classes

File: example_2_multiple_nodes_add

Recommend this page to a friend!
  Packages of Tony Frezza   HTML Generate   example_2_multiple_nodes_add   Download  
File: example_2_multiple_nodes_add
Role: Example script
Content type: text/plain
Description: Example 2 Multiple Nodes Add
Class: HTML Generate
Generate HTML from arrays
Author: By
Last change: edit class name to UML template
Date: 9 years ago
Size: 1,287 bytes
 

Contents

Class file image Download
<?php

/**
 * @author Tony Frezza
 * @copyright 2017
 */

    include('html.php');
    
    
    $html = new Html;
    
    $html->add(
        array(
            'tag'       =>  'h1',
            'text'      =>  'Hello World!',
        )
    );
    
    $html->add(
        array(
            'tag'       =>  'h2',
            'text'      =>  'I am a subtitle tag H2'
        )
    );
    
    $html->add(
        array(
            'tag'       =>  'h3',
            'text'      =>  'I am a subtitle tag H3'
        )
    );
    
    $html->add(
        array(
            'tag'       =>  'div',
            'text'      =>  'Hello! I\'m in a DIV tag! =)'
        )
    );
    
    $html->add(
        array(
            'tag'       =>  'a',
            'href'      =>  'http://google.com/',
            'target'    =>  '_blank',
            'text'      =>  'Link tag, with new tab'
        )
    );
    
    $html->add(
        array(
            'tag'       =>  'br',
        )
    );
    
    $html->add(
        array(
            'tag'       =>  'button',
            'onclick'   =>  'alert(\'Thank you!!!\')',
            'text'      =>  'A button (click me)'
        )
    );
    
    echo $html->getHtml();
    
?>