> Be aware, that you cannot overload constructors in > PHP. If you write > two CArticle Constructors in the CArticle class, > only the latter is > used. I'm not sure how this is in functions though, > it is quite > possible, that you can overload functions. >
There' s this (experimental extenstion, it says): http://php.belnet.be/manual/en/ref.overload.php, but normally you can't overload neither constructors nor general methods as far as I know: http://www.php.net/manual/en/functions.php. So for this constructor, you would prefer something like Alan's solution: function CArticle ($par_article_or_topic_id = -1, $par_article_name = NULL) { // if called with empty parameter set or explicitly with first param = -1 if ($par_article_or_topic_id = -1) { $article = mgd_get_article (); if (!$article) { $this = false; return false; } } // if called with one parameter it's the article ID elseif ($par_article_name === NULL) { $article = mgd_get_article(par_article_or_topic_id ); if (!$article) { $this = false; return false; } } // if called with both id and name it should refer to parent topic id // and article name to be found in this topic else { $article = mgd_get_article_by_name ($par_topic_id, $par_article_name); if (!$article) { $this = false; return false; } } $this->_copyMgdData($article); } Regards, pascal __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
