How can I get the current selected language using the Function JFactory::getLanguage();
from another directory?
I know how to do it when I am there:
- /web/include
- /web <---- [can call it from here] (solved here)
but I need to call it from...
- /web/scripts/myScripts/myScript.php
Tried to import Joomla Framework:
// Set flag that this is a parent file.
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/../../defines.php')) {
include_once dirname(__FILE__) . '/../../defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/../../includes/defines.php';
}
require_once JPATH_BASE.'/../../includes/framework.php';
// Instantiate the application.
$app = JFactory::getApplication('site');
// Initialise the application.
$app->initialise();
$lang =& JFactory::getLanguage()->getTag();