I'm struggling with a "noob question" in PHP : I would have a conf.php file containing something like that :
<?php
static $oauthConfig = array(
'facebook'=> array(
'appId' => 'xxx' ,
'secret' => 'xxx' ,
'loginURL' => 'xxx' ,
'logoutURL' => 'xxx'
) ,
'twitter' => array(
'appId' => 'xxx' ,
'secret' => 'xxx' ,
'loginURL' => 'xxx' ,
'logoutURL' => 'xxx'
)
);
?>
I need an array in order to add some nested levels to it, and keep it simple to understand and access, with something like :
//auth.php , in the same folder than conf.php
<?php
require_once( 'conf.php' );
$service = $_REQUEST[ 'ref' ];
switch( $service )
{
case 'facebook':
{
$params = $oauthConfig[$service];
$fb = OAuthFactory::getInstanceOf( $service , $params );
...
break;
}
}
...
?>
I don't figure how to use my conf.php file, since including it does not allow me to use the array. I tried some configurations (with/out static, etc.), but no way to get it work...
Unfortunately, parsing the Google Wisdom did not help me a lot for that.
I would avoid using .ini files or XML conf.