Created
May 21, 2014 12:14
-
-
Save roland-d/3e0a1958bdab5ef95b0d to your computer and use it in GitHub Desktop.
Bootstrapping an app for both Joomla 2.5 and Joomla 3.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set flag that this is a parent file. | |
// We are a valid Joomla entry point. | |
define('_JEXEC', 1); | |
// Setup the base path related constants. | |
define('JPATH_BASE', dirname(dirname(dirname(dirname(dirname(__FILE__)))))); | |
define('JPATH_COMPONENT_ADMINISTRATOR', dirname(dirname(__FILE__))); | |
define('JPATH_PLATFORM', JPATH_BASE . '/libraries'); | |
// Bootstrap the application. | |
require_once JPATH_BASE . '/includes/defines.php'; | |
require_once JPATH_PLATFORM . '/import.php'; | |
// Register PHP namespaces if we are on Joomla 3 | |
if (file_exists(JPATH_PLATFORM . '/classmap.php')) | |
{ | |
JLoader::registerNamespace('Joomla', JPATH_PLATFORM . '/framework'); | |
require_once JPATH_PLATFORM . '/classmap.php'; | |
} | |
// Import the JApplicationWeb class from the platform. | |
jimport('joomla.application.web'); | |
/** | |
* The import class. | |
*/ | |
class Import extends JApplicationWeb | |
{ | |
/** | |
* Execute the import. | |
* | |
* @return void. | |
*/ | |
protected function doExecute() | |
{ | |
// Put code here | |
} | |
} | |
JApplicationWeb::getInstance('Import')->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment