简体   繁体   English

如何扩展Joomla! 到我的自定义PHP文件

[英]How to extend Joomla! to my custom PHP file

I have a php file i created. 我有一个创建的php文件。 I want to extend all the Joomla! 我想扩展所有的Joomla! classes to that file. 该文件的类。 Or i at least want to be able to use Joomla's class for accessing the database within my PHP file. 或者我至少希望能够使用Joomla的类访问我的PHP文件中的数据库。 How can I extend the functionality that way? 如何以这种方式扩展功能? Thanks in advance. 提前致谢。

put these lines on top of your php file 将这些行放在您的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();

now you can use all joomla classes here 现在您可以在这里使用所有的joomla类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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