Micky Hulse wrote:
I assume setting basic strings (i.e. "settings") for my error messages
would be best done via:
class Randimg
{
var $msg_1 = 'This is a string';
var $msg_2 = 'This is another string';
function rand_img() { echo $this->msg_1; }
function foo() { echo $this->msg_2; }
}
I don't know if that's the *best* way, personally I'd not really do it
like that, but no-one can tell you it is 'right' or 'wrong' because it
depends on your application. For example if you only have a handful of
possible error messages (say < 10) then there is nothing inherently
wrong with the above approach.
If you're talking about lots of error messages then under PHP 4 I'd
declare them as consts in a required() file.
define('APP_ERROR_1', 'This is an error message');
Then just use APP_ERROR_1 in the methods that need it. It's a bit messy
because you are creating consts all over the place, but it's an option
for you and at least it keeps them all in a single file and out of the
header of your class.
Another way might be to create a specific class that does nothing but
handle error messages / responses, then call that.
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php