Is there a way to access Joomla 1.5 user variables (like user id) from a Flex 4 application using a PHP Data Service?

Posted by Zachary G. Schroeder on Stack Overflow See other posts from Stack Overflow or by Zachary G. Schroeder
Published on 2010-10-15T02:23:30Z Indexed on 2011/01/04 8:54 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about php

Related posts about flex4