0

i want to create the configuration file , which will have the application id and update path two variable , when i will pass the application id in the api it will return the update path of that application id . how i will achieve this making of configuration file.

regards

rahul

XMen
  • 29,384
  • 41
  • 99
  • 151
  • Which aspect is unclear exactly - how to structure the file, how to read it...? Please add more detail. – Pekka Oct 22 '10 at 11:50
  • I dont understand the question. Probably related or duplicate of [Reading and Writing Configuration Files](http://stackoverflow.com/questions/2237291/reading-and-writing-configuration-files) – Gordon Oct 22 '10 at 11:53
  • @Gordon good point, I'm voting as a duplicate of that question. @Rahul if that's not what you mean, say so – Pekka Oct 22 '10 at 12:01

3 Answers3

3

You can create an INI configuration file for your project and the parse it using php parse_ini_file function.

http://php.net/manual/en/function.parse-ini-file.php

Sample INI file

; This is a sample configuration file
; Comments start with ';', as in php.ini

[first_section]
one = 1
five = 5
animal = BIRD

[second_section]
path = "/usr/local/bin"
URL = "http://www.example.com/~username"

[third_section]
phpversion[] = "5.0"
phpversion[] = "5.1"
phpversion[] = "5.2"
phpversion[] = "5.3"

Here is another example for PHP configuration patterns

h++p://www.ibm.com/developerworks/library/os-php-config/index.html

Gaurav Jassal
  • 912
  • 1
  • 6
  • 6
1
<?php

if ( ! defined('EXT')){
exit('Invalid file request');
}

$conf['app_version'] = "167";
$conf['license_number'] = "";
$conf['debug'] = "1";
$conf['install_lock'] = "1";
$conf['db_hostname'] = "localhost";
$conf['db_username'] = "username";
$conf['db_password'] = "password";
$conf['db_name'] = "sample";
$conf['db_type'] = "mysql";
$conf['db_prefix'] = "exp";
$conf['db_conntype'] = "0";
$conf['system_folder'] = "system";
$conf['cp_url'] = "http://sample:8888/system/index.php";
$conf['doc_url'] = "http://expressionengine.com/docs/";
$conf['cookie_prefix'] = "";
$conf['is_system_on'] = "y";
$conf['allow_extensions'] = "n";
$conf['multiple_sites_enabled'] = "n";
?>
0

i have done it by making an array

    $config = array (
        "{b0ff543d-d294-42c8-83eb-d72161ec6771}"  => '/var/www/youngib/rahul/'
    );
$source=$config[$_REQUEST['applicationid']];

thanks

rahul

XMen
  • 29,384
  • 41
  • 99
  • 151