3

We can load Joomla framework in external file via http://docs.joomla.org/Framework_Compatibility

// Define JRequest::clean to protect our variables!
define('_JREQUEST_NO_CLEAN', 1); 

// basic to make J! happy
define('_JEXEC', 1); //make j! happy
define('JPATH_BASE', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);

// Load up the standard stuff for testing
require_once JPATH_BASE.DS.'includes'.DS.'defines.php';
require_once JPATH_BASE.DS.'includes'.DS.'framework.php';

but is there a way to include the default frontend template ?

Someone has already suggested this but it does not work http://westernstudios.net/tutorials/page/joomla-load-template-in-external-file

Any help is appreciated!

4
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define('JPATH_BASE',str_replace(basename(dirname(__FILE__)),"",dirname(__FILE__)));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe              = JFactory::getApplication('site');
$config                 = JFactory::getConfig();
$config->set('live_site','http://localhost/test/');// for js and css links
$mainframe->initialise();
$mainframe->route();
$mainframe->render();
echo $mainframe;

ok this one works

  • Ahh you were referring to the API, nott he framework. Wasn't aware :) – Lodder Oct 16 '14 at 17:18
  • yes , API in external file – Dan Oct 16 '14 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.