Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-11 Thread Micky Hulse
Hi Eric! Thanks for your reply. :) Eric Butera wrote: If at all possible you're going to want to use PHP5 if you're doing ...snip... of those "problems" have been alleviated. Gosh! I wish I could use PHP5... Unfortunately the hosting company I am using has not upgraded. I can not wait to star

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-11 Thread Eric Butera
On 5/10/07, Micky Hulse <[EMAIL PROTECTED]> wrote: Micky Hulse wrote: > Ah, well Chapter 6, page 144-145 have helped clear-up a little bit of my > confusion: Sorry, forgot to mention what book I was refering to: O'Reilly Programming PHP By Rasmus Lerdorf & Kevin Tatroe

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Micky Hulse wrote: Ah, well Chapter 6, page 144-145 have helped clear-up a little bit of my confusion: Sorry, forgot to mention what book I was refering to: O'Reilly Programming PHP By Rasmus Lerdorf & Kevin Tatroe -- Wishlists: Switch

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Micky Hulse wrote: Seems like I have always read/heard that it is best to explicitly pass variables as function parameters... vs throwing around "globals." Ah, well Chapter 6, page 144-145 have helped clear-up a little bit of my confusion: " .. Here's a simple class definition of the Pe

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Richard Davey wrote: Within the constructor for Randimg you could set a local protected variable: class Randimg { var $docroot = false; function Randimg () { $this->docroot = $_SERVER['DOCUMENT_ROOT']; } Hi Rich and all, just one other quick question... Which approach below would

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Richard Davey wrote: 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 .. Perfect answer! Thanks! I do not have too many error messages to store, but I do like the constant approach... Looks like

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Richard Davey
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 do

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Hi Eric! Thanks for the fast reply. I really appreciate the help on this one. :D Eric Butera wrote: As Rich pointed out you cannot have constants within a class in PHP4. To answer the second part of your mail, one technique that I have seen is something like the code below. Ahhh, that is inte

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Hi Rich! Thanks for the quick reply. I really appreciate your help. :) Richard Davey wrote: In PHP 5 could you create $docroot as a protected class constant, but in PHP 4 the above will have to do. Ahhh! Very interesting. Many thanks for the code example and explanation -- that approach works

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Eric Butera
On 5/10/07, Micky Hulse <[EMAIL PROTECTED]> wrote: Hi, This might be a real obvious question/answer... but I have been up all night geeking on code, so my mind is kinda mushy -- please be kind. :) I have a class called Randimg. Within that class, I have several methods. Within a few of those me

Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Richard Davey
Micky Hulse wrote: I have a class called Randimg. Within that class, I have several methods. Within a few of those methods, I use the below code snippet: $_SERVER['DOCUMENT_ROOT'] What would be the best way to assign the above code to a global variable/constant within the class? Within the

[PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Hi, This might be a real obvious question/answer... but I have been up all night geeking on code, so my mind is kinda mushy -- please be kind. :) I have a class called Randimg. Within that class, I have several methods. Within a few of those methods, I use the below code snippet: $_SERVER['