HTML Layout & Utility Class

HTML Layout & Utility Class

[ad_1]

To get this product on 50 p.c contact me on this link

 

LIVE PREVIEWBUY FOR $7

Changelog

Version 1.01

  • Fixed two small bugs due to damirg

What’s this?

This is an HTML utility class for creating any HTML aspect. (All HTML5 components are supported) together with some customized ones like youtube and vimeo strategies.

Basic utilization

Extract the primary zip file to the basis of your web site and have a look at the index.php. In quick, merely plug the ‘html’ listing into your utility and embrace the “htmlHTML.php” file then begin utilizing the category, it’s namespaced to AfflictoHTML.

Example

//this creates an anchor tag.
echo HTML::a('http://google.com', 'google');

Vimeo, and youtube movies:

echo HTML::youtube('http://www.youtube.com/watch?v=kkGeOWYOFoA');
echo HTML::vimeo('http://vimeo.com/46141955');

…nevertheless it’s greater than that!

I mentioned it’s a “utility” class, which it’s, because it allows you to create components rapidly and simply. You may also lengthen it, cross them as parameters to different elements of your purposes and so forth.

But it additionally permits nesting! – Let’s have a look…

$format = HTML::div(array(
    HTML::h1('header'),
    HTML::p('a paragraph right here'),
    'just a few textual content right here',
));
echo $format;

the classComposer technique

Along with the power to nest content material inside components, utilizing the classComposer technique permits you to rapidly create layouts with lessons with out writing a lot code. Let’s have a look:

HTML::classComposer(HTML::div(array(
    'class1 class2' => HTML::div()
)));
//creates a 'div' aspect with class="class1 class2" 

The classComposer technique works very well along with twitter bootstrap, for instance:

$container = HTML::classComposer(HTML::div(array(
    'row-fluid' => HTML::div(array(
        'span6' => html::div('first row, left column.'),
        'span6' => html::div('first row, proper column.'),
    )),
    'row-fluid' => HTML::div(array(
        'span6' => html::div('second row, left column.'),
        'span6' => html::div('second row, proper column.'),
    ))
)));
$container->addClass('container-fluid');

Although that is nice, however what if we may eliminate the keys totally?… this leads me to macros.

Macros

Macros permits you to add new performance to the HTML class. New “methods” if you’ll. Let’s proceed with out twitter bootstrap instance by creating some macros for containers, rows and spans.

HTML::macro('containerFluid', operate($content material) {
    return HTML::div($content material)->addClass('container-fluid');
    //the addClass technique returns the "$this" occasion. (it's chainable)
});
HTML::macro('rowFluid', operate($content material) {
    return HTML::div($content material)->addClass('row-fluid');
});
HTML::macro('span6', operate($content material) {
    return HTML::div($content material)->addClass('span6');
});

Now, let’s create the identical “container” div we created earlier, this time utilizing our new macros:

$format = HTML::containerFluid(array(
    HTML::rowFluid(array(
        HTML::span6('first row, left column.'),
        HTML::span6('first row, proper column.')
    )),
    HTML::rowFluid(array(
        HTML::span6('second row, left column.'),
        HTML::span6('second row, proper column.')
    )),
));

Of course, we will nonetheless pipe that by means of our classComposer technique so as to add further lessons if we need to:

$format = HTML::classComposer(
    'physique' => HTML::containerFluid(array(
        'header' => HTML::rowFluid(array(
            HTML::span6('first row, left column.'),
            HTML::span6('first row, proper column.')
        )),
        'content material' => HTML::rowFluid(array(
            HTML::span6('second row, left column.'),
            HTML::span6('second row, proper column.')
        )),
    ));
);

[ad_2]

To get this product on 50 p.c contact me on this link

 

Source

Pomento
Logo
Register New Account
Reset Password
Compare items
  • Total (0)
Compare
0
Shopping cart