I have written a script (in two files) that correctly displays a Joomla user id, like this:
//this is testy.php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(FILE));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$id = JFactory::getUser()->id;
The above file is located in the Joomla root folder. The other file is in a different directory and is as follows:
//this is testid.php
include '../../joomla/testy.php';
echo $id;
However, and here is the rub, when I change the "echo" to a "return" and put the second code snippet inside my Flex 4 Data Service script file, like this...
function getUserId() {
include '../../joomla/testy.php';
return $id;
}
...I get a Flex error that says this:
Fatal error: Class 'JRequest' not found in /var/www/html/joomla/libraries/joomla/import.php on line 33
I am extremely confused by this error and would appreciate any suggestions that the stackoverflow community may have.
Thanks so much!
Zach