skywaves
01-11-2010, 03:06 AM
Hi
i came across config file of moodle and saw that most of the code in config is as follows
/// Moodle Configuration File
unset($CFG);
$CFG->dbtype = 'mysql';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'user';
$CFG->dbpass = 'pass';
$CFG->dbpersist = false;
$CFG->prefix = '';
$CFG->wwwroot = 'http://moodle.local';
$CFG->dirroot = 'C:\eclipsepdt\workspace\moodle';
$CFG->dataroot = 'C:\eclipsepdt\workspace\moodle\moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 00777; // try 02777 on a server in Safe Mode
$CFG->passwordsaltmain = '@#$!%^&!@etLflh4+3Q?}@3)(~=LkS[2RfpOezD';
require_once("$CFG->dirroot/lib/setup.php");
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
in another package config settings were like
$config[dbtype] = 'mysql';
$config[dbhost] = 'localhost';
$config[dbname] = 'project';
$config[dbuser] = 'user';
$config[dbpass] = 'pass';
$config[dbpersist] = false;
$config[prefix] = '';
i have used code like second example but i have never seen code like first example. from the look it is object but it is without class and i see no difference in using associative array instead of this.
am i missing something?
i checked php manual but could not find answer.
please guide me in right direction
thanks
i came across config file of moodle and saw that most of the code in config is as follows
/// Moodle Configuration File
unset($CFG);
$CFG->dbtype = 'mysql';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'user';
$CFG->dbpass = 'pass';
$CFG->dbpersist = false;
$CFG->prefix = '';
$CFG->wwwroot = 'http://moodle.local';
$CFG->dirroot = 'C:\eclipsepdt\workspace\moodle';
$CFG->dataroot = 'C:\eclipsepdt\workspace\moodle\moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 00777; // try 02777 on a server in Safe Mode
$CFG->passwordsaltmain = '@#$!%^&!@etLflh4+3Q?}@3)(~=LkS[2RfpOezD';
require_once("$CFG->dirroot/lib/setup.php");
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
in another package config settings were like
$config[dbtype] = 'mysql';
$config[dbhost] = 'localhost';
$config[dbname] = 'project';
$config[dbuser] = 'user';
$config[dbpass] = 'pass';
$config[dbpersist] = false;
$config[prefix] = '';
i have used code like second example but i have never seen code like first example. from the look it is object but it is without class and i see no difference in using associative array instead of this.
am i missing something?
i checked php manual but could not find answer.
please guide me in right direction
thanks