2017 © Pedro Peláez
 

library zf2-widget

Similar to Yii Widgets for ZF2.

image

tokenpost/zf2-widget

Similar to Yii Widgets for ZF2.

  • Friday, July 4, 2014
  • by Tacnoman
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ZF2-widget

If you had an experience with Yii2 (or Yii 1.11), you could know about Widgets. In Yii Framework, widgets are used to create a part of view in your page. The advantage is that you may open an widget, write the code and close at the final., (*1)

If you want to use a piece of view in a big quantity of pages, this is perfect for you!, (*2)

For example, if you are using the Twitter Bootstrap and in all pages you use a Panel with an icon before the title. And you want to write a big text in the content (panel-body) you can make this., (*3)

namespace Application\Widget;

use TokenPost\Widget\Widget;

class Panel
{
  public $title;
  public $icon;

  public function init()
  {
    echo '

'; echo '
' . $this->title . '
'; echo '
'; } public function run() { echo '
'; echo '
'; } }

When you want to use in your view, you can use this:, (*4)



 'My Panel', 'icon' => 'cloud']) ?>


Here my content



This code will render:, (*5)

<div class="panel panel-primary">
  <div class="panel-heading">
    <span class="glyphicon glyphicon-cloud"></span>My Panel
  </div>
  <div class="panel-body">
    <!-- Here you will write your code.... -->
    Here my content
  </div>
</div>

You can learn more in this link: https://github.com/yiisoft/yii2/blob/master/docs/guide/structure-widgets.md, (*6)

New Feature

Now you can use the Html Helper class (Yii) in your Zend App., (*7)

The same example here:, (*8)

<?php

namespace Admin\Widget;

use TokenPost\Widget\Widget;
use TokenPost\Widget\Html;

class Panel extends Widget
{
  public $title;
  public $icon;

  public function init()
  {
      echo Html::beginTag('div',['class'=>'panel panel-primary']);
        echo Html::beginTag('div',['class'=>"panel-heading"]);
        echo Html::tag('span','',['class'=>'glyphicon glyphicon-' . $this->icon]) . $this->title;
        echo Html::endTag('div');

      echo Html::beginTag('div',['class'=>'panel-body']);
  }

  public function run()
  {
      echo Html::endTag('div');
    echo Html::endTag('div');
  }
}
}

Bug report

If you have a problem, sendme a message < renatocassino@gmail.com >, (*9)

The Versions

04/07 2014

dev-master

9999999-dev

Similar to Yii Widgets for ZF2.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php helper zf2 html widget zend framework 2

04/07 2014

v1.0

1.0.0.0

Similar to Yii Widgets for ZF2.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php helper zf2 html widget zend framework 2