Part of the EllisLab Network
This thread is a discussion for the wiki article: dip into CI
   
1 of 2
1
dip into CI
Posted: 18 July 2011 05:26 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  60
Joined  07-31-2009

Re: http://codeigniter.com/wiki/dip_into_CI/

I was using this with CI 1.7.2, but can’t seem to get it work with CI 2, I think the structure in CI 2 is a lot different than CI 1.7.2.

Has anyone gotten it working with CI 2?

Profile
 
 
Posted: 07 September 2011 10:38 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

I am interested in this too. I would like to accomplish a codeigniter dip but I am not sure if it works with 2.0.

Profile
 
 
Posted: 07 September 2011 10:46 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  60
Joined  07-31-2009

after a lot of time trying i never got it to work in the end.

Profile
 
 
Posted: 07 September 2011 06:55 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

I have been painstakingly looking for a way to introduce codeigniter interaction with my non-codeigniter based projects, whether it be wordpress or raw php pages. I have a model as well as views that I would like to use within a php pages outside of codeigniter.

What I am looking for is a way that I can create an instance within a non-codeigniter page something like:

include('codeigniter/hook.php');
    
$codeigniter =& get_instance();
    
$codeigniter->load->model('something_model');
    
$codeigniter->load->view('header'); 

  Does anyone know of a way to do this?

Profile
 
 
Posted: 07 September 2011 10:48 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

I just played around with it and got it to work, anyone who is interested in getting this working on codeigniter 2.0.3 let me know, I am thinking about posting a detailed guide on my blog (when I finish designing it). If you need help with the ci dip hit me up on twitter @thomasreggi or post below.

Profile
 
 
Posted: 08 September 2011 04:21 AM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  60
Joined  07-31-2009

Well done. I would love know how you did it!

Profile
 
 
Posted: 28 September 2011 02:06 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

Here are the files I used the get the dip working in CI 2.0+ https://github.com/reggi/CodeIgniter-Dip

Profile
 
 
Posted: 09 October 2011 09:28 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  03-27-2008

any able to get this to work with CI 2.0? I have tried using the 2.0 version downloaded from github but it kicks back this error

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

when embedding this code into my wordpress theme header file.

require($_SERVER['DOCUMENT_ROOT'].'/system/cidip/cidip_index.php');
$obj =& get_instance(); 

 Signature 

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

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

I just finished a ci & wp mash up http://reggi.com I received that error when i used get_header() and get_footer() a work around is just a straight up include().

Today I found this https://bitbucket.org/Lepidosteus/code-igniter-tools/src its an alternative dip.

I also have to remove the controller from the dip 2.0 on github, there is seemingly no need for it. Try the new version (Lepidosteus’) and get back to us.

Profile
 
 
Posted: 10 October 2011 07:34 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  03-27-2008

thanks my friend. but when i try this, for some strange reason, my system kicks back this message.

Your system folder path does not appear to be set correctlyPlease open the following file and correct thisindex.php 

and

No direct script access allowed 

when trying to access Common.php

but of course my index.php works just fine on the main site.

 Signature 

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

Profile
 
 
Posted: 10 October 2011 08:51 PM   [ Ignore ]   [ # 10 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

Hey latavish, I would love to help you out in real time my skype or aim handel is thomasreggi. You can email me via the contact box on the bottom of http://reggi.com/about and I will personally help you out and we can publish your issue here for future dip users. Let me know when you have some time.

Profile
 
 
Posted: 11 October 2011 09:57 PM   [ Ignore ]   [ # 11 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

I just installed the dip on a fresh ci install and I reworked some of the code the error you had common.php came up once in the reworking process. I also attempted to use this https://bitbucket.org/Lepidosteus/code-igniter-tools/src and it did not work for me. Here is my version https://github.com/reggi/CodeIgniter-Dip/

Profile
 
 
Posted: 12 October 2011 10:25 PM   [ Ignore ]   [ # 12 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  03-27-2008

thanks Thomas for all your help. gave this a try and getting this error message. going to play around with it some more to see what happens.

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: 12 October 2011 10:33 PM   [ Ignore ]   [ # 13 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

I already told you how to fix that:

I received that error when i used

get_header() 
and
get_footer() 
a work around is just a straight up
include() 
Profile
 
 
Posted: 12 October 2011 10:55 PM   [ Ignore ]   [ # 14 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  03-27-2008

you mean using an include to display header/footer in wp? i have tried this and still kicks back an error for me.

my WP get_header function

function get_header$name null {
 do_action
'get_header'$name );

 
$templates = array();
 if ( isset(
$name) )
  
$templates[] "header-{$name}.php";

 
$templates[] 'header.php';

 
// Backward compat code will be removed in a future release
 //if ('' == locate_template($templates, true))
  //load_template( ABSPATH . WPINC . '/theme-compat/header.php');
        
        
include_once('C:/wamp/www/soundsection/wp-content/themes/black/scaleblack/header.php'); 


still bring back

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: 12 October 2011 11:09 PM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  12
Joined  09-07-2011

Not sure if you need your own function for this…

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

 

Profile
 
 
   
1 of 2
1