Dr Casper Black Dr Casper Black - 4 months ago 10
PHP Question

joomla 2.5 standalone php JText::_() not working

I have a standalone file that generates an image, i included joomla framework. This file is displayed as image on the page. $_SESSION is empty and getUser returns NULL.
The JText does not know what module.language file to load and whats the default language for the user. How do I access this info/objects?

My code:

//define constant
define( '_JEXEC', 1 );

//joomla installation
define( 'JPATH_BASE', '../..' );

//include joomla core files
require_once( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
require_once( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
require_once( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' );

$echo = JText::_("MOD_MYMODULE_TEXT");

header("Content-type: image/png");


use this:

$lang =& JFactory::getLanguage();

or sue this , detect lang automatically:

$mainframe =& JFactory::getApplication('site');

$lang =& JFactory::getLanguage();