We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Porting a CI Controller to EE?

Development and Programming

Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

How would you go about porting a project built in CI to EE? What’s the best approach to reusing all my current CI code?

For example I have a Buy & Sell part of my website built in CI. It’s one controller with its models and views.

How do I make it viewable inside EE?

In EE there are templates for header and footer and then content in between. The usual.

But since the root of the site is controlled by EE, how would I include my Buy & Sell controller so it displays using EE’s header and footer?

Possible URL:s /buysell/new or /buysell/reciept or the root /buysell that displays the latest.

       
Ian from Aus's avatar
Ian from Aus
94 posts
14 years ago
Ian from Aus's avatar Ian from Aus

My thoughts would be to repackage it as an EE module.

The EE module system uses an MVC structure and you have access to CI through the EE global object so (hopefully) there shouldn’t be too many changes required. Anything sub-classed by EE might need to be modified however.

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

I think we need to begin at grass root level. =)

I haven’t tested yet, but can you place a controller somewhere in the EE file structure and access it like in CI, for example: http://website/NameOfController ? Is that possible?

       
Ian from Aus's avatar
Ian from Aus
94 posts
14 years ago
Ian from Aus's avatar Ian from Aus

Exactly like that, no. EE doesn’t provide any direct file system access or processing like that.

To extend EE you need to tell it to load your additional code, which is done through the Control Panel interface rather than configuration files.

The additional code therefore needs to be packaged as an EE add-on, in the case of an MVC application, a module.

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

That conclusion means that I cant build the functionalities i would like and used to do in CI.

Isnt this a huge blow for EE not to be able to have true CI MVC “apps”? I mean being stuck to one URL and stick plugin code for each url template. That really hinder you to develope the flow that you can with CI and MVC.

Do I have to rid EE and use a simple template system instead?

       
Ian from Aus's avatar
Ian from Aus
94 posts
14 years ago
Ian from Aus's avatar Ian from Aus

I am by no means an expert (hopefully they’ll be back from EECI soon!), but I believe that EE is more or less designed to be a complete system, with minor functionality attached. It is a whole CI app in itself after all.

Unfortunately I know little enough about CI development or the deep dark corners of EE to know exactly what can and can’t be done. Maybe it is possible to run multiple CI apps in parallel interfacing with each other, I don’t know, sorry.

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

Yeah hopefully some EE expert can answer soon!

The reason I bought EE was that I hoped I could build sections of the site with CI code so I didnt have to rewrite all my code again.

       
macuser's avatar
macuser
9 posts
14 years ago
macuser's avatar macuser

Well you should allways rewrite your code. Code is like evolution adapt or die, ask Robert C. Martin. Old code sooner or later begins to smell, after that it rots and then it dies. This has happend over and over again. Comapanys has gone out of business because of it. Treat your code as a friendship if you dont put some care into it, it will fail.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.