0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.