Slide 1: Quick Working Environment
This one's a keeper. Code appears in library.
<?php
$thisJoomlaRoot = '/path/to/your/public_html';
define('_JEXEC', 1);
define('JPATH_BASE', $thisJoomlaRoot);
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';
$app = JFactory::getApplication('administrator');
echo 'hello world';
Notes
- In the example here, I've defined a Joomla root and used that to define the JPATH_BASE
- In this instance, it's an "administrator" environment, but you youd use "site" too...
- In J! 2.5, you'd need some additional code, such as an $app->initialise(); See the J2.5.x index.php files for examples.
- Look at Joomla's own index.php files, front-end and administrator. This is basically a super-stripped-down version of those pages.
- This page: https://www.arraywebdevelopment.com/courses/jdatabase/slide01.php