Reputation: 1607
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 create 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?
Upvotes: 0
Views: 724
Reputation: 10609
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.
Upvotes: 1