Welcome Guest, Not a member yet? Register   Sign In
load variables in config file
#1

[eluser]Aaron L.[/eluser]
Hi There,

I am trying to integrate a 3rd party API with CI and so far everything is going pretty well. There is one hang-up that I am running into however:

In order to run the API, I have to send it some configuration settings. The api is accessed from multiple controllers, and so I have decided to create a separate file in /config which contains these variables and then include it in these controllers.

Here is an example of what I have so far:

/application/config/api_config.php:
Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

    $config['ID'] = '256562';
    $config['keysDirectory'] ="/var/www/html/keys";
    $config['sendToProduction']="false";
    $config['enableLog']="true";

?>

Here is a function within controller which uses (includes) the variables above:
/application/controllers/apicontroller.php

Code:
function something()
{
   //load the config file
   $this->load->config('cybersource_config');

   $request['something'] = "test123";
   $reply = array();
  
   //send info including config array from config file to the api
   run_transaction( $config, $request, $reply );

   redirect('home');

}

The problem I am having is that it seems like the $config variables are not being passed along to my controller. Any ideas?

Aaron


Messages In This Thread
load variables in config file - by El Forum - 07-17-2007, 07:14 PM
load variables in config file - by El Forum - 07-17-2007, 11:03 PM
load variables in config file - by El Forum - 07-18-2007, 02:00 AM
load variables in config file - by El Forum - 07-18-2007, 12:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB