开发者

Importing PHP code in Joomla Component development

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜