1
votes

I'm using the standard MVC with modules. I have 2 view helper classes that are autoloaded in the config using resources...

resources.view.helperPath.Module1_View_Helper = "module1/views/helpers/"
resources.view.helperPath.Module2_View_Helper = "module2/views/helpers/"

...both contain the same class and method name except for the prefix on the class.

class Module1_View_Helper_Notice extends Zend_View_Helper_Abstract {
public function notice() {

class Module2_View_Helper_Notice extends Zend_View_Helper_Abstract {
public function notice() {

My file...

/modules/[module]/views/scripts/[action]/index.phtml

...contains...

<?php echo $this->notice() ?>

How can I use a specific module view helper based on the path I'm currently in so that I do not have to create specific names for each method?

1

1 Answers

1
votes

Directly, I presume.

<?php
require_once (APPLICATION_PATH . '/modules/module1/views/helpers/Notice.php');
$helper = new Module1_View_Helper_Notice ();
$helper->setView ($this);
echo $helper->notice ();