Yii and Joomla (Session integration)

Hi Folks,

I am using Joomla to login in a Yii’s system that i’m developing. At Joomla I add some value in the Joomla session:




   $session =&JFactory::getSession();

   $session->set('userID', $id);



After this, Joomla redirects to Yii’s system. This system is a Joomla’s subdirectory in its structure. ('till here, alright)

The problem is when I try to recover the value using Yii’s session way of do it:




   $u= Yii::app()->session['userID'];  //DOESN'T WORK



I’ve tried to force Joomla to send the SessionID as parameter to Yii, and then use this SID to recover the Joomla session, but again without success.

Any help?

P.S.: Sorry my english!

[]s

João

Why not saving the sessions to database, then based on the SID retrieve them ?

This way, it doesn’t matter who sets the session and who is retrieving it as long as there is a common place for both applications (Joomla & Yii), the database.

Why redirecting from Joomla to Yii, when you can integrate?

Read this article, you can integrate an Yii application as a jumiapps, a module for joomla, so drows layout and menus with Joomla and embed in the content panel an Yii application.

In this application you will be able to call Joomla and Yii methods as well, I mean that in your Yii module you can do:




$session =&JFactory::getSession();

$session->set('userID', $id);



you can publish any script or css with joomla mehtods (so they will be in the header of the joomla page).

In this way user will not notice any redirect or change of style, and you are not forced to replicate the layout of the joomla page in your app.

If want to try this way, do as first as possible, as all css and script must to be thought in order not to override Joomla css or scripts. Developing a Joomla module with Yii is not as easy as develop an free Yii app, but the result will be surprising.

Let us know if it works!!