开发者

Use Joomla Classes within my php file

I have a joomla site and need an xml generating php script to run within it. The file is called by my module. The module works ok but I cannot get to crea开发者_高级运维te a php file that outputs the code, primarily because I can't use things like$db =& JFactory::getDBO();

Anyone with an experience on this front?


If you are calling a file that is outside of the joomla framework, then you need to create an instance of the joomla application so the code has access to joomla.

define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define('JPATH_BASE', dirname(__FILE__) );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

This should give you access to the basics.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜