This looks like a good job for a custom browsing assistant . Writing your own is very simple, and as soon as you try, you cannot stop!
Your own view helper should be in applications / views / helpers / NameOfHelper.php and should have a public method nameOfHelper (). I use the login as an example, as this is your use case in this case.
First create applications / views / helpers / Login.php: -
class Zend_View_Helper_Login extends Zend_View_Helper_Abstract { public function login() { return "Logging in!"; } }
Then in the view or layout just do: -
echo $this->login();
and get the result: -
Logging in!
It couldn't be easier!
Alternatively, if you want to use a script view, you can do this in your login () method: -
class Zend_View_Helper_Login extends Zend_View_Helper_Abstract { public function login() { $this->view->exampleVar = 'example value'; return $this->view->render('login.phtml') } }
Then, when you do echo $this->login() in your view or layout, you will see the desired result.
Obviously, you can put any code in the login () method.
source share