How to extend Joomla! to my custom PHP file

前端 未结 1 1218
忘掉有多难
忘掉有多难 2021-01-15 19:01

I have a php file i created. I want to extend all the Joomla! classes to that file. Or i at least want to be able to use Joomla\'s class for accessing the database within my

相关标签:
1条回答
  • 2021-01-15 19:34

    put these lines on top of your php file

    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

    0 讨论(0)
提交回复
热议问题