Part of the EllisLab Network
This thread is a discussion for the wiki article: dip into CI
   
2 of 2
2
dip into CI
Posted: 13 October 2011 05:27 PM   [ Ignore ]   [ # 16 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  03-27-2008

tried using

<?php get_template_part('header'); ?> 


still same error,

Fatal errorCall to a member function item() on a non-object in C:\wamp\www\system\core\Utf8.php on line 47 
 Signature 

———————————
Programming Is an Art

Profile
 
 
Posted: 13 October 2011 05:46 PM   [ Ignore ]   [ # 17 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

I have no clue, I would just check your wordpress header for any conflicting functions and boil your code down until it works, then step back and try to work around it.

Profile
 
 
Posted: 13 October 2011 05:50 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  03-27-2008

going to start over and start from scratch. . i have yet to let a code be me so i’m sure i’ll get it. wink thanks for all your help my friend..i’ll post the results when i get them. i’m sure its something very simple i’m missing.

 Signature 

———————————
Programming Is an Art

Profile
 
 
Posted: 22 October 2011 01:00 PM   [ Ignore ]   [ # 19 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  03-27-2008

think i almost have it. now just receiving this message.

Unable to locate the specified class: Security.php 

have you seen this message before using rdip?

 Signature 

———————————
Programming Is an Art

Profile
 
 
Posted: 22 October 2011 03:09 PM   [ Ignore ]   [ # 20 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

Nope, sorry man.

Profile
 
 
Posted: 04 February 2012 10:55 PM   [ Ignore ]   [ # 21 ]  
Summer Student
Avatar
Total Posts:  9
Joined  05-24-2011

I’m in a similar situation where I have to load CI views into wordpress.

It seems the culprit is Utf8.php class in the CI core
ci/system/core/Utf8.php

The __construct method in the class is what causes the problem

Fatal error: Call to a member function item() on a non-object in /../../../system/core/Utf8.php on line 47

Line 47

AND $CFG->item(‘charset’) == ‘UTF-8’ // Application charset must be UTF-8


After some tinkering it seems that you have to set

define(‘UTF8_ENABLED’, FALSE); instead of TRUE

To get it working, its hacky for now, but would be best to extend and override the constant
It’s possible to declare constant in base class, and override it in a child.

Now the next problem with this is that all my views are handled by codeigniter and not wordpress.
So back to the drawing board for now.

Hope this helps a bit.

 Signature 

Code Strong

Profile
 
 
Posted: 04 February 2012 11:03 PM   [ Ignore ]   [ # 22 ]  
Summer Student
Avatar
Total Posts:  9
Joined  05-24-2011
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class 
MY_Utf8 extends CI_Utf8
{
   
public function __construct()
   
{
   define
('UTF8_ENABLED'FALSE);
   
}

Will solve the charset problem, just place this in application/core/MY_Utf8.php

 Signature 

Code Strong

Profile
 
 
Posted: 04 February 2012 11:45 PM   [ Ignore ]   [ # 23 ]  
Summer Student
Avatar
Total Posts:  9
Joined  05-24-2011

How I am loading the codeigniter instance, this is in the functions.php file of my WP theme.

function load_codeigniter()
{
 
require($_SERVER['DOCUMENT_ROOT''/CI/application/tools/rdip.php');
 
$GLOBALS['CI'$CI;
}
add_action
('init','load_codeigniter'); 

And how I’m calling my views

<?php echo $CI->load->view('listings/sidebar'''TRUE); ?> 

Still having problems with CI overriding my WP nav, will post with solution when I have it fixed

 Signature 

Code Strong

Profile
 
 
Posted: 04 May 2012 02:56 AM   [ Ignore ]   [ # 24 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

Andre, glad to see your making progress.

I’m going to update the dip soon. The repo is here if you’re interested https://github.com/reggi/cidip (just. changed it)

Anyone who needs help or wants me to update it should contact me directly or go watch the dip on github.

As the dip gets older and codeigniter versions increase eventually the dip file will need to be replaced with the new core index or the dip will not work.

The video tutorial is still available http://www.youtube.com/watch?v=KCmLseX1uSQ

Happy dipping.

Profile
 
 
Posted: 04 May 2012 08:48 AM   [ Ignore ]   [ # 25 ]  
Summer Student
Avatar
Total Posts:  9
Joined  05-24-2011

Thanks for the response, I had a hell of a time getting wordpress and CI to behave together.  Ultimately what I did ( due to client time constraints ) was have wordpress handle my url routing, place the CI installation in a sub-folder ( outside of the public directory ) and used get_footer, get_header, get_sidebar etc… within my codeigniter views.  It’s wonky but it works.  I think its kind of the reverse of what your trying to achieve here, I’ll definitely give the repo a gander and see what I can come up with.

 Signature 

Code Strong

Profile
 
 
Posted: 08 May 2012 06:32 PM   [ Ignore ]   [ # 26 ]  
Summer Student
Total Posts:  7
Joined  03-19-2010

Hi Thomas,
      Just wanted to say thanks for this, it’s useful for using CodeIgniter’s active record library without having to convert my whole site over.
      I’m working on a project with lots of different dev environments, so I wanted to share my code for determining the codeigniter_dir. I’ve put codeigniter in an includes/classes directory. This assumes you’re always using .php files somewhere without any mod_rewrite.

//Detect path
$patharray explode('/'$_SERVER['REQUEST_URI']);
$realpath '';
foreach(
$patharray AS $path){
    
if(!preg_match('/(.+)\.php/'$path))
    
{
        $realpath 
.= $path
        
$realpath .= "/";
    
}
}
$codeigniter_dir 
$realpath "includes/classes/codeigniter"

    Thanks,
    Jordan

Profile
 
 
Posted: 10 May 2012 08:07 AM   [ Ignore ]   [ # 27 ]  
Grad Student
Rank
Total Posts:  60
Joined  07-31-2009

Nice work!

I’m in the middle of testing it out on my site now, but I’ve run into a problem. It seems the dip is somehow effected by my default controller?

Every time I try to access http://my.site/example.php (the dip example) I get redirected to http://my.site/dashboard This .is a redirection which is defined in my default controller, if I comment out the redirect, the dip example works fine.

Any ideas?

Profile
 
 
Posted: 10 May 2012 08:28 AM   [ Ignore ]   [ # 28 ]  
Grad Student
Rank
Total Posts:  60
Joined  07-31-2009

Okay, so I think I fixed it. Just commented out the entire “Call the requested method” section of rdip.php.

Really impressed by this - so much cleaner than the dip which existed for CI 1.7

Thanks!

Profile
 
 
Posted: 17 May 2012 02:17 PM   [ Ignore ]   [ # 29 ]  
Summer Student
Avatar
Total Posts:  4
Joined  03-16-2012
ThomasReggi - 04 May 2012 02:56 AM

I’m going to update the dip soon. The repo is here if you’re interested https://github.com/reggi/cidip (just. changed it)

I can’t even tell you the amount of work you saved me with this package. I had an old system that I built custom without a framework a long time ago that needed some updating, mainly in the authentication department. I was able to use Ion Auth now within my old and busted scripts via dip. Thanks so much!

Profile
 
 
   
2 of 2
2