How to create a stand-alone application using the Joomla! Platform
From Joomla! Documentation
(Difference between revisions)
m |
|||
| Line 21: | Line 21: | ||
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); | require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); | ||
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); | require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); | ||
| + | /* To use Joomla's Database Class */ | ||
| + | require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' ); | ||
/* Create the Application */ | /* Create the Application */ | ||
$mainframe =& JFactory::getApplication('site'); | $mainframe =& JFactory::getApplication('site'); | ||
Revision as of 10:01, 14 April 2009
[This is based on my experiments, I expect more knowledgeable people to jump in!]
In order to use the Joomla! Framework alone, you would have to follow the following guidelines:
- Keep this folder/files from a normal Joomla! install:
- includes/
- libraries/
- configuration.php
- Edit configuration.php to match your server database/username/password/paths/etc.
- Create the required tables in the database
- Note: Normally only the table #__session is needed, but if you want to stay safe, just use the whole structure of a Joomla! install (without the samples!)
- Create an index.php file in the root with the following starting code:
/* Initialize Joomla framework */ define( '_JEXEC', 1 ); define('JPATH_BASE', dirname(__FILE__) ); define( 'DS', DIRECTORY_SEPARATOR ); /* Required Files */ require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); /* To use Joomla's Database Class */ require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' ); /* Create the Application */ $mainframe =& JFactory::getApplication('site'); /**************************************************/ // Your code starts here... /**************************************************/
- Note: It is possible to use Joomla! framework without a database. To do that, pass a config array containing session as a key with the value of false in the call to JFactory::getApplication() like this:
/* Create the Application */ $mainframe =& JFactory::getApplication('appname', array('session' => false));
After that, you can still use a file based authentication system if you want.