CodeCanyon HTML Layout & Utility Class 5200636

CodeCanyon HTML Layout & Utility Class 5200636

CodeCanyon HTML Layout & Utility Class 5200636
PHP Script \ Help \ Support Tool
Html \ Class \ Helper \ Utility \ Video \ Youtube \ Template \ Vimeo \ Layout \ Help

PHP Script - HTML Layout & Utility Class 5200636 by afflicto @ CodeCanyon

PHP Script \ Help \ Support Tool

Last Update: 18 July 13; Software Version: PHP 5.3, PHP 5.4; Files Included: PHP.

What’s this?

This is an HTML utility class for creating any HTML element. (All HTML5 elements are supported) including some custom ones like youtube and vimeo methods.

Basic usage

Extract the main zip file to the root of your website and look at the index.php. In short, simply plug the ‘html’ directory into your application and include the “htmlHTML.php” file then start using the class, it’s namespaced to AfflictoHTML.

Example

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

Vimeo, and youtube videos.

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

..but it’s more than that!

I said it’s a “utility” class, which it is, as it lets you create elements quickly and easily. You can also extend it, pass them as parameters to other parts of your applications etc.

But it also allows nesting! – Let’s take a look…

$layout = HTMLdiv(array(
HTMLh1('header'),
HTMLp('a paragraph here'),
'just some text here',
));
echo $layout;

the classComposer method

Along with the ability to nest content within elements, using the classComposer method allows you to quickly create layouts with classes without writing much code. Let’s take a look.

HTMLclassComposer(HTMLdiv(array(
'class1 class2' => HTMLdiv()
)));
//creates a 'div' element with class="class1 class2"

The classComposer method works really well together with twitter bootstrap, for example.

$container = HTMLclassComposer(HTMLdiv(array(
'row-fluid' => HTMLdiv(array(
'span6' => htmldiv('first row, left column.'),
'span6' => htmldiv('first row, right column.'),
)),
'row-fluid' => HTMLdiv(array(
'span6' => htmldiv('second row, left column.'),
'span6' => htmldiv('second row, right column.'),
))
)));
$container->addClass('container-fluid');

Although this is great, but what if we could get rid of the keys entirely?.. this leads me to macros.

Macros

Macros allows you to add new functionality to the HTML class. New “methods” if you will. Let’s continue with out twitter bootstrap example by creating some macros for containers, rows and spans.

HTMLmacro('containerFluid', function($content) {
return HTMLdiv($content)->addClass('container-fluid');
//the addClass method returns the "$this" instance. (it is chainable)
});
HTMLmacro('rowFluid', function($content) {
return HTMLdiv($content)->addClass('row-fluid');
});
HTMLmacro('span6', function($content) {
return HTMLdiv($content)->addClass('span6');
});

Now, let’s create the same “container” div we created earlier, this time using our new macros.

$layout = HTMLcontainerFluid(array(
HTMLrowFluid(array(
HTMLspan6('first row, left column.'),
HTMLspan6('first row, right column.')
)),
HTMLrowFluid(array(
HTMLspan6('second row, left column.'),
HTMLspan6('second row, right column.')
)),
));

Of course, we can still pipe that through our classComposer method to add additional classes if we want to.

$layout = HTMLclassComposer(
'body' => HTMLcontainerFluid(array(
'header' => HTMLrowFluid(array(
HTMLspan6('first row, left column.'),
HTMLspan6('first row, right column.')
)),
'content' => HTMLrowFluid(array(
HTMLspan6('second row, left column.'),
HTMLspan6('second row, right column.')
)),
));
);

Event/Hook class.

Keywords: embed, help, helper, helper class, html, html builder, html class, layout, smart, template, utility, utility class, video, vimeo, youtube.



Tags: Class, Utility, Helper, Layout, Video, Vimeo, Youtube

Premium CodeCanyon HTML Layout & Utility Class 5200636 WordPress Themes, Website Templates, Mobile Themes, Flash Templates & Scripts from creative professional designers. Full details of CodeCanyon HTML Layout & Utility Class 5200636 for digital design and education. CodeCanyon HTML Layout & Utility Class 5200636 desigen style information or anything related.

Comments:

Name:*
E-Mail:*
Add Comments:
Enter Code: *