简体   繁体   中英

How to include helper file from custom template?

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

有一种“核心”方式来添加文件。

JLoader::register('MyHelperClass', JPATH_ROOT . '/modules/mod_breadcrumbs/helper.php');

You can use include() or include_once() to achieve this.

http://us2.php.net/manual/en/function.include.php

http://us2.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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM