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

3
  • Which aspect is unclear exactly - how to structure the file, how to read it...? Please add more detail. Commented Oct 22, 2010 at 11:50
  • I dont understand the question. Probably related or duplicate of Reading and Writing Configuration Files Commented Oct 22, 2010 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 Commented Oct 22, 2010 at 12:01

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

Comments

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";
?>

1 Comment

Posting your thoughts as well as your code is more useful as a solution/answer
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.