It’s handy to use in Zend FW driven project. For example, you want to make an in-place tracker (e.g. Google Analytics) — you create a helper class My_View_Helper_Tracker inherited from Zend_View_Helper, Zend finds its automatically and then you are free to use your helper method:
echo $this->tracker( $trackerID );
The question is what you gonna do if you want a base class for a family of trackers?
It’s not so obvoius due to naming conventions.
Let’s say you want 2 kinds of trackers: Google Analytics and Euroads.
1. You create such files structure:
library
- My
- View
- Helper
- Tracker
Abstract.php
- Google
Page.php
- Euroads
Owner.php
Guest.php
2. You name your classes as:
- My_View_Helper_Tracker_Euroads_Guest (extends My_View_Helper_Tracker_Abstract)
- … so on …
3. Class methods are:
public function tracker_euroads_guest(...) ...
4. And the trickiest part: the helper call:
echo $this->tracker_Euroads_Guest
Recent Comments