How to gradually convert a site over to CodeIgniter?

I've been doing a lot of research in regards to OO and MVC for PHP and have nearly made a choice to move to CodeIgniter for an existing large-scale website I manage. I feel that using an OO+MVC environment has a huge organizational and performance advantages and hopefully improved developing speed compared to the existing functional/procedural structure the site uses now.

However, due to the sheer size of the site, I would like to gradually transfer the code over to CodeIgniter's structure thus having a transitional time period where parts of the site are in CI and others are in the old style.

Are there any suggestions on the best way to do this from a code structure point of view while minimizing on the amount of duplicate code? I'm rather new to OO as well, and feel that gradual is the best way to do this due to the learning curve.


You could install CI into a folder and redirect (though .htaccess ) only the requests that you want to handle with CI. Other than that, everything should work as usual and you won't need to change much of your current functionality. The more sections work on CI, the more redirect rules you will have.


I think you have to determine the dependent entities in your database (models) and start with them first such as some contacts, users registration and so on.

The most reliable and safe way, you have to copy your current working site to a local machine and start do it bit by bit, till you finish it all, upload it to your public web server.


I would just write the entire site (almost) from scratch, locally, then when everything's working and tested upload it to the server.

By 'almost' from scratch I mean you could copy some of the HTML into View files, and perhaps use some of the existing PHP for piecing together parts of the backend, but I think you'll have to write most of it from the start. I made a semi-large scale web in object oriented way using the MVC pattern, and even transfering that to CodeIgniter wouldn't be a trivial task, much less a website that's written completely procedurally. That is my opinion.

链接地址: http://www.djcxy.com/p/66674.html

上一篇: 如何将通知从网站发送到Android应用程序

下一篇: 如何逐步将网站转换为CodeIgniter?