Skip to content

HTMLTag

Mistralys edited this page Jan 7, 2022 · 7 revisions

The HTMLTag helper class can be used to generate individual HTML tags with an easy to use, chainable object-oriented API.

Quickstart

use AppUtils;

echo HTMLTag::create('code')
   ->addClass('preformatted')
   ->id('code-snippet')
   ->attr('data-format', 'pretty')
   ->content('Content here');

Output (formatted for readability):

<code class="preformatted" id="code-snippet" data-format="pretty">
    Content here
</code>

Examples

Adding a property

use AppUtils;

echo HTMLTag::create('select')
   ->name('product')
   ->prop('multiple')
   ->renderOpen();
<select name="product" multiple>

New here?

Have a look at the overview for a list of all helper classes available in the package.

Table of contents

Find the current page in the collapsible "Pages" list above, and expand the page, to view a table of contents.

Clone this wiki locally