-
Notifications
You must be signed in to change notification settings - Fork 2
Helpers
dbald edited this page Sep 16, 2010
·
3 revisions
Home > Helpers
Helpers allow you to have commonly used code grouped together for easy reuse. Typically helpers are targeted to a specific use such as a calendar helper, date helper, or even a shipping helper. They are mainly just another level of abstraction. Helpers live in the helpers folder and follow all the regular naming conventions.
<?php
/* Basic helper setup */
class Test_Helper {
public $requiredSystemMode = "production";
public $minimumSystemVersion = "1.0.0b";
public $maximumSystemVersion = "2.0";
function __construct() {
}
function testMethod() {
echo "Foo Bar.";
}
}
?>There may be a case when you are using a helper that is using certain functionality that may not be supported by the version of the framework that you are using. That is the reason for the 3 public variables defined in the basic helper setup as shown above. These variables are optional but can be very helpful when you are wanting to setup a helper that you intend to reuse on multiple projects.
<?php
/* When set this option will only allow the helper to load if the System.mode matches the set string bellow. */
public $requiredSystemMode = "production";
/* When set this option will only allow the helper to load if the System.version is not lower than the defined version. */
public $minimumSystemVersion = "1.0.0b";
/* When set this option will only allow the helper to load if the System.version is not higher than the defined version. */
public $maximumSystemVersion = "2.0";
?>