[Solar-talk] helper stack

Paul M Jones pmjones at solarphp.com
Fri Aug 25 11:53:42 PDT 2006


On Aug 21, 2006, at 7:02 AM, Jeff Surgeson wrote:

> Rodrigo, thanks just what I needed, however
>> $view = $this->_getView();
>> $view->addHelperClass($stk);
>
> I have added it to my setup() in my app and if I do a dump of $view  
> it shows
> that the new path has been added to the stack (Buuldog_App_Helper)
>
> ["_helper_class:protected"] => object(Solar_Class_Stack)#16 (2) {
>     ["_stack:protected"] => array(6) {
>       [0] => string(19) "Bulldog_App_Helper_"
>       [1] => string(31) "Watchmanager_App_Browse_Helper_"
>       [2] => string(24) "Watchmanager_App_Helper_"
>       [3] => string(25) "Watchmanager_View_Helper_"
>       [4] => string(18) "Solar_View_Helper_"
>       [5] => string(18) "Solar_View_Helper_"
>     }
>     ["_config:protected"] => array(0) {}
>
> However it still not searching the helper path from the view level,  
> as per the
> error message
>
> Fatal error: Uncaught exception 'Solar_Exception'
> class::code 'Solar_Class_Stack::ERR_CLASS_NOT_FOUND' with
> message 'ERR_CLASS_NOT_FOUND' information array ('name'
> => 'GetFileSize', 'stack' => array (
> 0 => 'Watchmanager_App_Browse_Helper_',
> 1 => 'Watchmanager_App_Helper_',
> 2 => 'Watchmanager_View_Helper_',
> 3 => 'Solar_View_Helper_',
> 4 => 'Solar_View_Helper_', ), )
>
> What am I missing?

You want to add it to the view object the controller uses  
automatically, not create your own view.  The way to do this is to  
override _getView() in your app.

public function _getView()
{
	// build a $stack, and then...
	$view = parent::_getView();
	$view->addHelperClass($stack);
	return $view;
}

Let me know if this this helps, or if I have missed the point.



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list