thipages/quicktag

Quick html tags builder

v0.7.0 2020-07-30 07:21 UTC

This package is auto-updated.

Last update: 2024-03-29 02:31:23 UTC


README

Quick Html tags builder

Installation

composer require thipages\quicktag

Usage of QTag class

Basic usage

Maps are associative arrays mapping tags attributes

    // *************
    // CONTENT TAGS
    // *************
    QTag::tag ($tag, ...$map)($content) : String
    QTag::tag ($tag, ...$map1)($content,$map2]) : String
    // *************
    // VOID TAGS
    // *************
    QTag::tag ($tag, ...$map):String
Examples
$blue=['style'=>'color:blue'];

$html=QTag::tag('span',$blue)('Hello QTag');
/* <span style="color:blue">Hello QTag</span> */

$html=QTag::tag('input', ['type'=>'num','min'=>2]);
/* <input type="num" min="2" /> */
Templating usage - Content tags
   QTag::tag ($tag, ...$map1)[($content, ...$map2, true)]n($content, ...$mapN) : String

Examples

$blue=['style'=>'color:blue'];

$template=QTag::tag('span',$blue)('Hello QTag', true);
$html=$template('...and more");
/* <span style="color:blue">Hello QTag...and more</span> */
Templating usage - Void tags
    QTag::tag ($tag, ...$map1, true)[(...$map2, true)]n(...$mapN) : String
Examples
$blue=['style'=>'color:blue'];
$min=['min'=>2];

$template=QTag::tag('input',$blue, true);
$html=$template($min);
/* <input style="color:blue" min="2"/> */