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';
精彩评论