我创建了一个php文件。我想扩展所有的Joomla!该文件的类。或者我至少希望能够使用Joomla的类来访问我的PHP文件中的数据库。如何以这种方式扩展功能?提前谢谢。
答案 0 :(得分:5)
将这些行放在php文件的顶部
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__).'/../../../../' ); // should point to joomla root
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
现在你可以在这里使用所有joomla类