xandrkat/yii2-simply

Simplification of HTML helper Yii Framework 2.0.

dev-master / 1.0.x-dev 2019-12-22 13:40 UTC

This package is auto-updated.

Last update: 2020-01-22 13:50:47 UTC


README

This extension is a simplification of HTML helper Yii Framework 2.0.

Html Class

This class extends the Yii Html Helper . The helper functions available in this class are:

  • Html::bebin{anyTag}(['whithot class as key']),
  • Html::end{anyTag}()
  • Html::{anyTag}('content', ['whithot class as key'])

As

<?=\xandrkat\simply\Html::beginDiv(['container']).'any text'.\xandrkat\simply\Html::endDiv()?>
// result <div class="container">any text</div>
<?=\xandrkat\simply\Html::beginDiv(['class' => 'container']).'any text'.\xandrkat\simply\Html::endDiv()?>
// result <div class="container">any text</div> 
<?=\xandrkat\simply\Html::beginDiv(['container', 'class' => 'bg-primary']).'any text'.\xandrkat\simply\Html::endDiv()?>
// result <div class="container bg-primary">any text</div> 
// or simple tag
<?=\xandrkat\simply\Html::p('any content', ['text-center'])?>
// result <p class="text-center">any content</p>
<?=\xandrkat\simply\Html::p('any content', ['class' => 'text-center'])?>
// result <p class="text-center">any content</p>
<?=\xandrkat\simply\Html::p('any content', ['text-success', 'class' => 'text-center'])?>
// result <p class="text-success text-center">any content</p>

Or

use xandrkat\simply;

<?=Html::beginDiv(['container']).'any text'.Html::endDiv()?>
// result <div class="container">any text</div>
<?=Html::beginDiv(['class' => 'container']).'any text'.Html::endDiv()?>
// result <div class="container">any text</div> 
<?=Html::beginDiv(['container', 'class' => 'bg-primary']).'any text'.Html::endDiv()?>
// result <div class="container bg-primary">any text</div> 
// or simple tag
<?=Html::p('any content', ['text-center'])?>
// result <p class="text-center">any content</p>
<?=Html::p('any content', ['class' => 'text-center'])?>
// result <p class="text-center">any content</p>
<?=Html::p('any content', ['text-success', 'class' => 'text-center'])?>
// result <p class="text-success text-center">any content</p>

Attention

Html::a(), Html::img() etc. inherits yii\helpers\Html

License

yii2-helpers-simplyHtml is released under the BSD-3-Clause License. See the bundled LICENSE.md for details.