it-swarm.dev

Come caricare il framework Joomla in un file esterno incluso il modello?

Possiamo caricare il framework Joomla in un file esterno tramite 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';

ma c'è un modo per includere il modello frontend predefinito?

Qualcuno lo ha già suggerito, ma non funziona http://westernstudios.net/tutorials/page/joomla-load-template-in-external-file

Qualsiasi aiuto è apprezzato!

3
Dan
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 questo funziona

4
Dan