Reputation: 249
Tell me please how to include helper file from custom template?
For example i want get the the ModBreadCrumbsHelper class from /modules/mod_breadcrumbs/helper.php
in the custom template /templates/test/html/com_content/article/default.php
Upvotes: 3
Views: 2607
Reputation: 1873
There is a "core" way to add files.
JLoader::register('MyHelperClass', JPATH_ROOT . '/modules/mod_breadcrumbs/helper.php');
Upvotes: 5
Reputation: 80
You can use include() or include_once() to achieve this.
https://www.php.net/manual/en/function.include.php
https://www.php.net/manual/en/function.include-once.php
Example: (inside /templates/test/html/com_content/article/default.php)
include "/modules/mod_breadcrumbs/helper.php"; // provided the directory "modules" is inside the directory containing "default.php"
$class = new ModBreadCrubmsHelper();
$class->stuff();
Upvotes: 0