Cocoon Development Considerations

February 1, 2007 – 2:34 pm by Ralph Dahlgren

Things that make me say “Hmmmmm.?.!.?.!”…

Obscure | Redundant Functions
Is there a reason why we need the $etomite->getConfig($name) function…???
function getConfig($name='') {
// returns the requested configuration setting_value to caller
// based on $key=>$value records stored in system_settings table
// $name can be any valid setting_name
// Example: getConfig('site_name')
if(!empty($this->config[$name])) {
return $this->config[$name];
} else {
return false;
}
}

Why would I write something like:
if($var = $etomite->getConfig("site_name")) { do_something(); }

When I could just as easily write:
if($var = $etomite->config['site_name']) { do_something(); }

The results are exactly the same, using less clock cycles…

Is there a reason why we need the $etomite->getVersionData() function…???
function getVersionData() {
// returns a $key=>$value array of software package information to caller
include("manager/includes/version.inc.php");
$version = array();
$version['release'] = $release;// Current Etomite release
$version['code_name'] = $code_name;// Current Etomite codename
$version['version'] = $small_version; // Current Etomite version
$version['patch_level'] = $patch_level; // Revision number/suffix
$version['full_appname'] = $full_appname; // Etomite Content Management System + $version + $patch_level + ($code_name)
$version['full_slogan'] = $full_slogan; // Current Etomite slogan
return $version;
}

Wouldn’t it just be easier to have the array right in the include file…??? That way $version could be expanded without changing the function itself and $version could be loaded directly into a global class variable all at once…
// version.inc.php
$version = array();
$version['release'] = $release;// Current Etomite release
$version['code_name'] = $code_name;// Current Etomite codename
$version['version'] = $small_version; // Current Etomite version
$version['patch_level'] = $patch_level; // Revision number/suffix
$version['full_appname'] = $full_appname; // Etomite Content Management System + $version + $patch_level + ($code_name)
$version['full_slogan'] = $full_slogan; // Current Etomite slogan
?>

And then getVersionData() could be something like:
function getVersionData() {
// returns a $key=>$value array of software package information to caller
include("manager/includes/version.inc.php");
$this->version = $version;
}

And better yet, these settings are already being loaded into $this->config[] by the getSettings() function…

Some handy new features which might be of help to developers:

A panel that lists all available configuration variables which can be used anywhere using [(var_name)]…

Post a Comment