Skip to content

1stthomas/ht7-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ht7 - Html

Abstract

How to use it

use \Ht7\Html\Tag;

$tag = new Tag('div', ['inner text.'], ['id' => 'ht7-inner-1', 'class' => 'inner']);
echo $tag;
// output: <div class="inner" id="ht7-inner-1">inner text.</div>

While there is no way to add attributes directly to Tag instance, you need to gain the attribute list first. After that you can add further attributes to the attribute list. At the end there is no need to readd the attribute list again, because it was given by reference.

use \Ht7\Html\Attribute;

$aL = $tag->getAttributes();
$aL->addPlain($name, $value);
// or:
$aL->add((new Attribute($name, $value)));

Method chainning is also supported:

$tag->getAttributes()
    ->addPlain($name1, $value1)
    ->addPlain($name2, $value2);

Testing

Trigger the unit tests with following CLI command:

$ composer test-unit

or run the functional tests by:

$ composer test-func

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages