Web Gear is a free, lightweight open source web development platform written in PHP, aimed at developing fast web applications, based on a well defined MVC structure.

Application

Helpers

Helper Application::getHelper(string name)

Returns the helper identified by the requested name, if it was loaded, or null otherwise.

Registry Application::getHelpers()

Returns a Registry object containing all the helpers loaded up to that point. The returned value is a collection of Helper objects.

Loading a helper object

Helpers can be loaded at any point in your application, after the action has been dispatched to the controller. The method prototype looks like this:

Helper Application::loadHelper(string name[, array params = array()])

Parameters

  • name: the helper to load. The source file has to be placed in the includes/helpers/ directory and must be named name.php. Also, the class defined within this source file must be called name_Helper and MUST extend the base class Helper
  • params: additional parameters that you want to be passed in to the helper object constructor upon initialization

Return values

  • Helper: an instance of the requested helper object will be returned

This method will always throw an IOException exception if the library source file was not found, or a Base_Exception exception if the file doesn't contain a class (or the class does not extend the Helper class).