skip to content

Class EpcSiteHelper

Power Content’s helper has a lot of useful methods developers can take advantage of. EpcHelper is an abstract class placed at: root /components/com_epc/helpers/EpcHelper.php 

If you wish to use those classes outside of Power Content, make sure you require the file.

Let’s take a look at those methods:

EpcSiteHelper::getModel($fileName); - Method to get one of Power Content’s models. Simply pass the name of the model file. For example: (‘item’) or (‘category’). This method will require and instantiate the model you asked for.

EpcSiteHelper::getConfigParam($param); - Method to get the value of a Power Content parameter of the configuration. For example: (‘usePagination’). You can find the names of the parameters in the config.xml of the component, in the admin section.

EpcSiteHelper::renderSystemMessage(); - Generic method to render the system message in the layout.

EpcSiteHelper::formatDate($date); - Method that formats dates to the following format: January 23, 2017. Just pass the date in a raw format.

EpcSiteHelper::cutString($string, $characters, $addDots); - Method that truncates strings, can be used for intro text and stuff like that. The first argument $string is the string to truncate; the second argument $characters is an integer of how many words this string should contain; and the last argument, $addDots, is a Boolean, True or False if to add “…” to the end of the string or not. Default is false.

EpcSiteHelper::renderModules($position); - Method to render modules by position in the layout. Just pass the position of the modules you wish to render as a string, and whole the modules with this position will be rendered in the layout.

EpcSiteHelper::getDataFromDb($column, $table, $where); - Some generic method to quickly get an object list from the database, pass the column (‘fields’), the table (#__epc_items) and a where clause (“id = 2”). The where clause is a string so you can extend It like (“id = 2 AND …”)

Still have questions? ask in the community group!
Was this article helpful?
8
10