2017 © Pedro Peláez
 

markup html

PHP-based HTML Markup generator

image

xiphe/html

PHP-based HTML Markup generator

  • Monday, June 10, 2013
  • by Xiphe
  • Repository
  • 2 Watchers
  • 3 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

HTML - a PHP-based HTML Markup generator

The main benefits are:, (*1)

  • no switching between php and html or echoing of html strings needed when you are inside your php stuff.
  • Minimalistic usage attempt and helper functions. You should be able to generate more html markup with less php instructions while keeping full flexibility.
  • Auto-indention. Unless you turn it of to save whitespace you will receive beautifully indented and super-readable markup for your web-projects.

The main downfalls are:, (*2)

  • Page generation takes longer, because every html-tag will run through a lot of php functions while being generated.
    (I use it along with wordpress and can not make a humanly noticeable difference in page loading speed when changing from a default wp-theme to one that uses the generator.)
  • It may be difficult to learn how to use this, compared to writing pure html.

This project is inspired by the CakePHP HtmlHelper., (*3)

Demo-/Testpage
Documentation(phpDocumentor), (*4)

Installation

Wordpress

  1. Download the latest "alldeps" branch
  2. Extract the archive and upload the plugin into the /wp-content/plugins/ directory of your wordpress project.
  3. Activate the plugin through the 'Plugins' menu in WordPress

Standalone

Use composer and require "xiphe/html": "2.0.*", (*5)

or download the latest "alldeps" branch, extract it and put it anywhere in your php project. Then include [path to]/bootstrap.php or [path to]/vendor/autoload.php., (*6)

Basic Usage

Follow the Installation steps to initiate the global $HTML variable., (*7)

<?php
/* Get access to an instance of Xiphe\HTML */
global $HTML

/* Opens a std HTML5 header - leaves you inside the <head> */
$HTML->HTML5()
    /* print a <title> */
    ->title('HTML Example')
/* close the <head> tag */
->close('head')
/* open a <body> tag (s_[tag] will just open a [tag] - no </tag> will be echoed) */
->s_body()
    /* open a 

<

div> tag with the class attribute "wrap" */
    ->s_div('.wrap')
        /* open an <article> tag with an id */
        ->s_article('#article1')
            /* print a 

<

h1> with multiple attributes */
            ->h1('Hello Stranger', array('style' => 'color: red;', 'rel' => 'title'))
            /* <3 */
            ->p('Thank you for checking out Xiphe\HTML - that\'s very kind of you')
            /* Another way to pass multiple attributes to a tag */
            ->img('src=http://upload.wikimedia.org/wikipedia/commons/c/ce/Example_image.png|alt=example')
/* close all Tags that have been opened previously */
->close('all');

Output:, (*8)

<!DOCTYPE HTML>
<html class="no-js">
    <head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
        <title>HTML Example</title>
    </head>
    <body>
        <div class="wrap">
            <article id="article1">
                <h1 rel="title" style="color: red;">Hello Stranger</h1>
                <p>Thank you for checking out Xiphe\HTML - that's very kind of you</p>
                <img alt="example" src="http://upload.wikimedia.org/wikipedia/commons/c/ce/Example_image.png" />
            </article><!-- #article1 -->
        </div><!-- .wrap -->
    </body>
</html>

Want to dig deeper? poke me to write a better documentation. Or check out the Test/Examples Hybrid on html.xiphe.net., (*9)

3rd Party

  • Js/Css Minifiying from Fat-Free Framework
    Distributed under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
    Copyright (c) 2009-2012 F3::Factory/Bong Cosca
  • PHP Diff by Chris Boulton (Used for the Demos/Tests. Will not be loaded in productive usage).
    BSD License
    Copyright (c) 2009 Chris Boulton chris.boulton@interspire.com
    All rights reserved.
  • Markdown
    PHP Markdown & Extra
    Copyright (c) 2011, Dragonfly Development Inc
    All rights reserved., (*10)

    Based on PHP Markdown & Extra
    Copyright (c) 2004-2009 Michel Fortin
    http://michelf.com/
    All rights reserved., (*11)

    Based on Markdown
    Copyright (c) 2003-2006 John Gruber
    http://daringfireball.net/
    All rights reserved., (*12)

  • phpDocumentor was used to generate the documentation under /doc

Changelog

2.0.10

  • mergeClasses method added to core\Generator

2.0.9

  • minor bugfixes and compatibility to THETOOLS v1.0.7

2.0.8

  • Select Module updated

2.0.7

  • New Logic for Content::compress()
  • Googleanalytics Module allowes $HTML->googleanalytics('UA-0000000-0') for a simple, compressed ga tracker code
  • Added basic Sublime Text 2 snippet

2.0.6

  • fixed bugs related to Store::get()
  • desktop/mobile classes on html tag if THETOOLS are available.

2.0.5

  • callbacks for tags
  • configuration modes
  • bugfixes

2.0.4

  • fixed wp textdomain error

2.0.3

  • if() and endif() pseudotags
  • BasicModule::generate() generates a default tag using the module parameters.
  • When Generator::call is called directly, tag options can now be passed as a third argument in addition to prefix them to the Tag

2.0.2

  • composer update test.

2.0.1

  • composer compatible.
  • now uses composer versions off php-diff and markdown.

2.0.0

  • COMPLETE REMAKE. Most functionality should still work the same way as in 1.x but most likely not everything.
    • Introducing the Xiphe\HTML namespace
    • Better modular OOP Structure
    • Minimalistic Instances + most logic is now static.
    • Tag Instances
    • Test Cases
    • much more...

pre 2.0

  • see changelog.txt

Bugs

  • The fist line of a multi-lined <li> has a false indention when cleaned with strong mode.

Todo

  • radio and checkbox group generation
  • Functionality to add own modules and manipulate the TagInfo Class.
  • More Test Cases
  • Still better documentation
  • Array-style attribute maipulation on Tags would be nice. $Tag[id] = 'myID';

The Versions

10/06 2013

dev-master

9999999-dev https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

22/04 2013

dev-alldeps

dev-alldeps https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

22/04 2013

2.0.10

2.0.10.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

17/04 2013

2.0.9

2.0.9.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

28/01 2013

2.0.8

2.0.8.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

17/01 2013

2.0.7

2.0.7.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

14/01 2013

dev-cacheFunctionality

dev-cacheFunctionality https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

11/01 2013

2.0.6

2.0.6.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

09/01 2013

2.0.5

2.0.5.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

09/01 2013

2.0.4

2.0.4.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

09/01 2013

2.0.3

2.0.3.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

08/01 2013

2.0.2

2.0.2.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup

08/01 2013

2.0.1

2.0.1.0 https://github.com/Xiphe/HTML

PHP-based HTML Markup generator

  Sources   Download

GNU GENERAL PUBLIC LICENSE

The Requires

 

generator html markup