rockstardev
rockstardev

Reputation: 13527

Zend equivelant of YII Widgets?

In YII you can easily create a widget that you can call on a view:

$this->widget(....)

What is the equivelant of this in Zend? I want to be able to create a "widget" that displays a special type of table that works just by passing data to it.

Upvotes: 1

Views: 95

Answers (1)

user133408
user133408

Reputation:

You can use Zend View Helper. You create class with predefined signature, and then use it in view. Example view helper class:

class Zend_View_Helper_Hello
{
    // Notice: function name is same as last class name part
    public function hello($name)
    {
        // Code here
        return sprintf('Hello %s!', $name);
    }
}

Then in your view:

echo $this->hello('John');

Upvotes: 1

Related Questions