Integrating codeigniter into wordpress
-
Ok, bit of a foreword:
I know this isn’t advisable; I have already built a system back-end in CodeIgniter, the client has a wordpress theme he wants to use though, and to manage the front end pages.
I’ve managed to get this working up to a point:
I’ve got wordpress installed at root level /
then I have codeigniter off the root at /ci/
In my codeigniter ‘index.php’ I have the following to avoid the ‘site_url’ collision.
require_once '../wp-blog-header.php'; add_filter('site_url', 'ci_site_url', 1); function ci_site_url() { include(APPPATH.'/config/config.php'); return $config['base_url']; }
This is all OK; I can call get_header & get_footer from CodeIgniter which is great.
What is causing me no end of grief though, is WordPresses handling of sessions. I’m using a codeigniter session, which is actually stored within the $_COOKIE array by the looks of things.
On the codeigniter pages I have that call the get_header and get_footer functions, the codeigniter session ($_COOKIE) seems to be getting reset. On the inital load, its present but on any subsequent requests its disappeared. I’ve been going through codeigniters code forever trying to find anything that might be doing this. The only thing remotely similar is ‘wp_unregister_GLOBALS()’ in load.php (wp_includes)
However this is not the cause. I’ve tried commenting out this function and the problem remains.
Is there anywhere in WordPress that may be causing this to be reset/emptied?
Strangely enough, pages created through WordPress seem to be ok. Just CI pages that are calling the get_header / footer functions.
- The topic ‘Integrating codeigniter into wordpress’ is closed to new replies.