Integrating Yii in Joomla

Hello

I tried to integrate the yiiFramework into joomla (should be possible, shouldnt it?)

I integrated yii with a component, insteat a view joomla loads the yii-app.

The url is like this:


http://localhost/joomla/index.php?option=com_yiiTest

and in the component file i call the Yii -App like this:


include(JPATH_SITE.DS.'yiiapp'.DS.'index.php' );

  1. Probem:

I think the Yii-Autoloader tries in the YiiBase.php to load Joomla-Classes as well,

the following line is the problem:


00324:             include($className.'.php');

I tried to to fix this like this:


if(file_exists($className.'.php')){

	include($className.'.php');

}

and this fixed the error and the site loaded… but:

when i try to run the blog-demo the following error happens:


 Class 'Post' not found

Does somebody know what i’m doing wrong or how I can do it?

Is it possible at all?

Thank you for an answer

phil

i don’t think the file_exists is the fix,

because it wouldn’t load any of the classes not even the Post class

if i think logic i would assume something like that would be the problem

in that logic i think you should make a correct definition to you classes paths

if not the problem of the routing not being fully functional anymore

i have no idea i’m new on this aswell

yes, thought about the same

when I don’t do my fix, the different autoloader don’t like each other.

will try something in this direction,

thank you for you help

phil

I’ve done it!

The autoloader from joomla doesn’t like so I had done a little fix to it…

Now a new problem:

I call yii as a component like this : www.site.com/index.php?option=com_yii

the problem is that it should save the Parameter "option=com_yii" on each link i click in the yiiApplication.

How can I do this?

I found the urlManager in the config but I don’t get on with it well.

So have somebody maybe an idea how I can say Yii each link I click should include the GET-Parameter "option=com_yii"

Thank you for an answer

phil

You can extend CUrlManager like this:




class UrlManager extends CUrlManager

{

  public function createUrl($route,$params=array(),$ampersand='&')

  {

    return parent::createUrl($route, $params += array('option'=>'com_yii'), $ampersand);

  }

}



Save to file UrlManager.php e.g. in the protected/components directory.

Edit:

Also specify class in config




'urlManager'=>array(

  'class'=>'UrlManager',

  'urlFormat'=>'get',

...

),



/Tommy

Works perfect, thank you very much!

Gartenschlauch,

Please tell us, what was the fix in the joomla’s autoloader ?

Thanks!

Dear gartenschlauch:

Please tell us, what was the fix in the joomla’s autoloader ? thanks very much. I would like to know.

Here is a complete tutorial about integration of yii in joomla.

It allows you to use nice url, like:

www.siteInJoomla.com/yiiApp/user/12.shtml