Yii CMenu with IPB or vice versa?

Hi all,

I’m having trouble to bring Yii CMenu into IPB header like www.yiiframework.com done.

Is there anyway to use Yii Framework code in IPB or vice versa?

Can any body help me?

Thank you so much,

Regards,

What is IPB?

IPB = Invision Power Board

A way would be like:




   function yiiBridge()

   {

       $yii=dirname(__FILE__).'/../framework/yii.php';

       $config=dirname(__FILE__).'/protected/config/main.php';

       require_once($yii);

       return Yii::createWebApplication($config);

   }



And somewhere into the IPB bootstrap or header template call this function.

This will make all the YII methods available to you but will bot run the request, so it is exactly what you want .

After you call this function, you can easily use Yii::app()-> Yii::ETC methods in your IPB installation.

This is not tested, but in the way Yii is built, it should work without problems.

Thank you twisted1919 for your hind. I tried and found some problems:

It seems like that we need to re-create the whole Yii skeleton structure inside forum, this is not what I want.

I’m trying to re-declare Yii working path inside IPB, if you get any hind please let me know.

Thank you very much,

Best Regards,

I just looked at the page source and found this div:


<div id='ipbwrapper'>

The rest of the page seems to be fairly standard Yii view code.

That’s leading me to believe that the entire page is managed by Yii, and they’re using a wrapper to display the forum.

I bet that you can get a sample wrapper from Invision.

@jacmoe,

There are a lot of javascript from IPB in <head> and <body id=‘ipboard_body’> when you view source, so I think this must be IPB loading Yii.

Any idea can help?

@CalvinMusic -

Seems that Yii will set the paths having in mind the place from where the app has been created.

A way to fix this, in your main.php file, set the "basePath" like:




'basePath'=>'D:\xampp\projects\whateverProjectName',



"whateverProjectName" is the folder holding your forum and yii app.

Also, before doing this, i believe you also should move the "framework" folder into the root of your website, near the generated app, so that you have the following structure:




--/framework

--/protected

--/themes

--/forum

--/index.php



Warning, when you will change the structure, please adjust index.php bootstrap, main.php and the yiiBridge() to the correct paths.

Please let me know if this works, but be careful and follow each instruction .

If you get errors, let me know what are those.