Skip to content

Instantly share code, notes, and snippets.

@mockiemockiz
Last active August 29, 2015 14:08
Show Gist options
  • Save mockiemockiz/99e1c6faba6574e9d251 to your computer and use it in GitHub Desktop.
Save mockiemockiz/99e1c6faba6574e9d251 to your computer and use it in GitHub Desktop.
<?php
// module/User/src/User/View/Helper/Hellohelper.php
/**
* Created by PhpStorm.
* User: mockie
* Date: 11/8/14
* Time: 5:33 AM
*/
namespace User\View\Helper;
use Zend\View\Helper\AbstractHelper;
class Hellohelper extends AbstractHelper
{
public function __invoke($str)
{
return $str.' okeee';
}
}
<?php echo $this->hello_helper($this->myvar); ?>
//yourModule/config/module.config.php
'view_helpers' => array(
'invokables'=> array(
'hello_helper' => 'User\View\Helper\Hellohelper'
)
),
public function testAction()
{
$this->layout()->myvar = 'teeeeeeeeeeeeest';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment