请告诉我如何在自定义模板中包含帮助文件?
例如,我想从/modules/mod_breadcrumbs/helper.php获取ModBreadCrumbsHelper类
自定义模板中的/templates/test/html/com_content/article/default.php
答案 0 :(得分:5)
添加文件有一种“核心”方式。
JLoader::register('MyHelperClass', JPATH_ROOT . '/modules/mod_breadcrumbs/helper.php');
答案 1 :(得分:0)
您可以使用include()或include_once()来实现此目的。
http://us2.php.net/manual/en/function.include.php
http://us2.php.net/manual/en/function.include-once.php
示例:(在/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();