开发者

Importing PHP code in Joomla Component development

开发者 https://www.devze.com 2023-01-27 07:42 出处:网络
Can\'t figure out how to import php files into my joomla component- all of these fail: require_once(\'code.php\');

Can't figure out how to import php files into my joomla component- all of these fail:

  • require_once('code.php');
  • require_once(dirname(FILE).DS.'code.开发者_C百科php');
  • require_once(JPATH_COMPONENT.DS.'code.php' );

Any ideas? thanks


require_once(JPATH_COMPONENT_SITE.'/path/inside/your/component/folder.php');

Also - don't use DS - it is deprecated in Joomla 3.0


Try jimport, see Joomla's docs on this: http://docs.joomla.org/Jimport

jimport('joomla.application.component.controller');

This will include the php file "/libraries/joomla/application/component/controller.php".


Usually these are included in a helper.php file

require_once dirname(__FILE__).'/helper.php';
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号