Thank you for your answer, I have already been doing that, I was hoping that there was another with a bit more flexability. I am writing a Web Blog program and had a table with some default values for certain things, but for flexabiliy, i wanted to have several ways to call the function, such that if the user wanted to specify his/her own value they could... this can be seen in the function 'Blog_Page' Where the default value for iSqlLimit is already defined by the class constructor (as retrieved from a database). However the 'end user' would have the option to pass a value of thier own if desired.
see here is what i have now:
class Blogger {
function Blogger($sInstall_Location)
{
if (is_readable($sInstall_Location."configuration_ini.php")) {
$aConfiguration = parse_ini_file($sInstall_Location."configuration_ini.php", true);
require($aConfiguration['LOCATION']['install_path']."shr/dal/dal_init.php");
}
$this->oDB = new Database;
$this->Datastream = $this->oDB->connect($aConfiguration['DATABASE']['host'], $aConfiguration['DATABASE']['user'], $aConfiguration['DATABASE']['pass']);
$this->sAboutTable = $aConfiguration['TABLES']['about'];
$this->sBlogTable = $aConfiguration['TABLES']['entries'];
$this->sResponseTable = $aConfiguration['TABLES']['comments'];
$this->sCategoryTable = $aConfiguration['TABLES']['categories'];
$this->sUserTable = $aConfiguration['TABLES']['users'];
$this->sSetupTable = $aConfiguration['TABLES']['setup'];
if ($rSetupInfo = $this->oDB->query("SELECT * FROM ".$this->sSetupTable)) {
$this->aSetupInfo = $this->oDB->fetch_array($rSetupInfo);
}
return $this->aSetupInfo;
}
}
class Blogger_Entries extends Blogger {
function Blog_Page($iStartPage = 0, $iSqlLimit = null, $iCat_id = 0, $iBlog_id = null, $sSearchString = null) {
$this->iStartPage = $iStartPage;
if (is_null($iSqlLimit)) {
$this->iSqlLimit = $this->aSetupInfo['show_entries'];
} else {
$this->iSqlLimit = $iSqlLimit;
}
$this->iCat_id = $iCat_id;
$this->iBlog_id = $iBlog_id;
$this->sSearchString = $sSearchString;
//more code.... more code....
}
}
zooming in on the function 'Blog_Page' is would be much more elegant I think to have the ability to define it something like this:
function Blog_Page ($iStartPage = 0, $iSqlLimit = $this->aSetupInfo['show_entries'], $iCat_id = 0, $iBlog_id = null, $sSearchString = null)
thereby eliminating the need for all the IF statements below...
Ahh well, thank you for the answer.
Cheers!