Welcome Guest, Not a member yet? Register   Sign In
Question About Legacy Code....
#1

[eluser]drbigfresh[/eluser]
I am somewhat new to CodeIgniter, but I am trying to convert an old site over to the framework. I need to keep some of the old code working, since I don't have enough time to convert it all at once, but I am running into a problem with some of the old code. I have a page (in my views folder) that includes an old Database call like such:

include_once($_SERVER['DOCUMENT_ROOT'] . '/config/local_db.php');
include_once($_SERVER['DOCUMENT_ROOT'] . "/adodb/adodb.inc.php");


$db = NewADOConnection("mysql");

$db->Connect('localhost', 'root', 'xxx', 'xxx') or die($db->ErrorMsg());

If I go to the page directly, it works fine, but when I go thru the framework I get the 'unable to connect' error message. Does anyone have an idea on how to work around this or what the problem might be?

I have the controller for the page just doing some includes:

function showsubscribepage()
{
$data['title']="Subscription";

$this->load->view('view_header',$data);
$this->load->view('view_subscription',$data);
$this->load->view('view_footer',$data);

}

Any help is way appreciated. Thanks!
#2

[eluser]Randy Casburn[/eluser]
Are you using PHP 5?

This looks distinctly familiar...PHPHTMLLIB by any chance?

Randy
#3

[eluser]drbigfresh[/eluser]
Yeah, php 5. I'm not using PHPHTMLLIB, it is ADOdb (http://phplens.com/lens/adodb/docs-adodb.htm).
#4

[eluser]Randy Casburn[/eluser]
This could be a 'namespace' related problem where you have some variables colliding.

With later versions of PHP5 the concept of 'namespaces' has been introduced to allow us to segregate systems like this. If you have the ability to stick with v5 and implement namespaces, it may be a sort of 'stopgap' that would allow you to implement a sort of bridge pattern.

I just made about 1,234,567,003,234 assumptions. Forgive me for that, but hope this is helpful.

Randy




Theme © iAndrew 2016 - Forum software by © MyBB