dev-master
9999999-dev https://github.com/oscarotero/view-helpersCollection of useful functions to use in your templates.
MIT
The Requires
- php ^7.0
The Development Requires
helpers html string utils view
Wallogit.com
2017 © Pedro Peláez
Collection of useful functions to use in your templates.
Collection of useful functions to use in your templates., (*1)
Collection of helpers for text manipulation:, (*2)
$pieces = ['one', 'two', 'three']; echo ViewHelpers\Text::join($pieces); // "one, two and three" echo ViewHelpers\Text::join($pieces, ' | '); // "one | two and three" echo ViewHelpers\Text::join($pieces, ', ', ' & '); // "one, two & three"
Functions to generate html, (*3)
$element = ViewHelpers\Html::element('div', [
'id' => 'my-id',
'class' => ['class1, class2'],
'style' => [
'font-size' => '2em',
'color' => 'blue'
],
'hidden' => true
]);
echo $element; //
<
div id="my-id" class="class1 class2" style="font-size: 2em; color: blue" hidden>
$element = ViewHelpers\Html::picture(
[
'default.jpg',
'(min-width: 2000px)' => 'image_2000.jpg',
'(min-width: 1000px)' => 'image_1000.jpg',
'(min-width: 500px)' => 'image_500.jpg',
],
'Alt text'
);
echo $element;
/*
<picture>
<source srcset="image_2000.jpg 1x, image_4000.jpg 2x" media="(min-width: 2000px)">
<source srcset="image_1000.jpg" media="(min-width: 1000px)">
<source srcset="image_500.jpg" media="(min-width: 500px)">
<img src="default.jpg" alt="Alt text">
</picture>
Collection of useful functions to use in your templates.
MIT
helpers html string utils view