[PHP] Good Class/API Design ?

2004-10-25 Thread Adam Reiswig
Hey all, I just got my hands on the excellent books PHP Anthology 1  2 
and am wanting to start playing around with classes.  My question to the 
list is, what, in your opinion, constitutes good class/api design?  Is 
it better to design several smaller classes that each focus on one task 
and do that task well, or to build more general classes that handle a 
number of related tasks?

Also, when you are beginning a new project, what methods do you find 
helpful to follow in taking your project from concept to finished?

The books also mention ways to use phpDocumentor to document your code 
and SimpleTest to test your code as it is written.  These along with 
some XP techniques I read about seem like good practices to follow. 
Does anyone have any other ideas/practices that it would be good for a 
new oop developer like myself to make a habit it of?

Thanks!!
--
Adam Reiswig

Accelerating into the unknown...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Self Testing PHP Code... Is it possible or practical??

2004-05-27 Thread Adam Reiswig
Hello all.  I have been reading much lately about the wonders of writing 
self testing code for java, perl and others.  Is this a feasible task to 
accomplish in PHP?  I have googled every search I can think of and there 
just does not appear to be any information regarding self testing php 
out there.  Thanks for any pointers, ideas, advice or help you may have.

-Adam R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] $this variable reference question

2004-04-02 Thread Adam Reiswig
I was trying to bend my mind around the concept of the reference 
operator () today and came across an article at 
http://www.onlamp.com/pub/a/php/2002/09/12/php_foundations.html where 
the author gave the following example:

?php
class test {
function test($val) {
global $myref;
$myref = $this;
$this-value = $val;
}
function printval() {
echo The value of this class is '{$this-value}' br;
}
function setval($val) {
$this-value = $val;
}
}
?
My question is actually regarding the line $myref = $this;.  The 
author states that this is a reference to the class/object itself. 
Isn't this like saying outside the class $myref = new test;?  What 
would be the point of referring to itself inside the class in this 
manner?  Thanks for your help in advance!

-Adam Reiswig

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: $this variable reference question

2004-04-02 Thread Adam Reiswig
Jason, thanks.  Yes, I understand your example here very well.  My 
question actually had more to do with understanding what value was added 
to the class by $myref = $this;.  Perhaps it is some misunderstanding 
I have of classes but, since a class is just a pattern and not an 
actual, usable object in and of itself, what is the value in equating a 
member variable with the class.  Almost seems recursive. Even though 
$myref is set to global it is still a member variable, right?  Does 
$this refer to the class pattern or is it creating an object of itself 
inside the class, sort of an object inside an object?  I guess my 
problem in understanding this is not so much where this sort of coding 
should be used but rather what is really going on here.  Thanks again!

-Adam Reiswig

Jason Barnett wrote:

It's not the same thing.  When an variable references an object then you 
can change either the original object or the new variable and you will 
be changing the *same* object, not a new one.  Maybe this example helps?

?php

class test {
function test($val) {
global $myref;
$myref = $this;
$this-value = $val;
}
function printval() {
echo The value of this class is '{$this-value}' br;
}
function setval($val) {
$this-value = $val;
}
}
$a = new test();
$b = $a;
$c = new test();
$a-setval(22);
$b-setval(321);
$c-setval('A weird comment');
$a-printval(); // should see 321
$b-printval(); // should see 321
$c-printval(); // should see A weird comment
?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] CMS Templating with Standards Based HTML Delima...

2004-03-20 Thread Adam Reiswig
I have just been to hotscripts.com looking under their php area for good 
cms software.  The sheer number of choices is staggering to say the 
least.  I found Smarty and it seems like it might make a good choice for 
my needs.   I am really looking to fill two needs.

One, a robust cms in which I can create standards based web templates 
(ie, table less layouts using xhtml strict and css)

and Two, an easy method in which my clients can still edit their own 
content with out having to learn anything new, or at least as little as 
possible.  Some sort of wysiwyg would be great if that's possible with 
out conflicting with existing css styles and as long as it didn't insert 
font tags and tables all over.

Is there a good open source php based cms system out there that can do 
the above?  I'd sure like to know about it.  Thanks for any pointers!

-Adam R.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] object oriented php game... how classes interact question

2004-03-11 Thread Adam Reiswig
Hello all.  I am getting ready to write a simple online game using html 
 php.  Since I am learning about php classes I thought it would be fun 
to try my hand at writing all the scripting in object oriented style.  I 
have done as much research as I can find just about and the only thing I 
have not found is a good example of is how classes interact.

I am trying to determine whether I can have a php that simply initiates 
the game and then the rest of the logic and interaction can be 
controlled by various classes that interact among themselves or if I 
need the main php file to act as a moderator to control the logic.

For instance, my game will have pegs, a board and a scripted user 
who responds to the real person's guesses.  I am assuming that I would 
then create a class for each that corresponds with its real life object. 
  Then say the computer user needs to place a peg in response to a 
players move.  Would it be better to script that as a copy of my user 
class with a function for placing a copy of my peg class in a hole 
variable in a board class?  Or, should the main php file simple call 
the user class to determine which peg should go in which hole and 
then call the board class and assign a peg to the correct hole?

I am still trying to understand all this so please be patient with me if 
none of this makes any sense at all.  Let me know if I need to be more 
specific with something and I'll do my best.  Thanks for any help or 
advice in advance.  Also if anyone knows of any good articles online 
that you could point me to, I'd be most grateful.

-Adam R.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] how classes interact question clarification question

2004-03-11 Thread Adam Reiswig
To clarify my question, can one class directly call a function or change 
a variable of another class or is the main php file the only way to 
interact between the two or more classes?  Thanks again!!

-Adam R

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: using mail() for multiple email address...

2004-03-09 Thread Adam Reiswig
yes, my webhost is on Unix.  Thanks, that must be it because I sent a 
regular email to both address's at the same time and I only received one.

-Adam Reiswig

[EMAIL PROTECTED] wrote:
On 8 Mar 2004 Adam Reiswig wrote:


Normally, the two emails would end up in the same pop account but don't
seem to be when I use the above script.  If I send to one or the other
they receive appropriately, but if I send to both at the same time, I
only receive one email, not both.  If anyone can help me as to why this
is and if there is a remedy, I'd sure like to know about it.  Thanks a lot!!


Is this on a Unix box?  The same box where the domain is hosted?  If so 
I think sendmail does that -- it notices the duplication, and only 
sends the message once.

--
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] using mail() for multiple email address...

2004-03-08 Thread Adam Reiswig
Hello all, I have a strange problem with the mail() function.  It may
not be php at all.  I have multiple email accounts at my website.  I
just started testing the mail() function to learn how it works.  When I
send to multiple address' separating them via a comma, all goes well
until I send the same email to my main account and another address that
in turn redirects it to my main account.  For example:
if (mail([EMAIL PROTECTED], [EMAIL PROTECTED], test, no
body really...))
print(successful);
else
print(unsuccessful);
Normally, the two emails would end up in the same pop account but don't
seem to be when I use the above script.  If I send to one or the other
they receive appropriately, but if I send to both at the same time, I
only receive one email, not both.  If anyone can help me as to why this
is and if there is a remedy, I'd sure like to know about it.  Thanks a lot!!
-Adam Reiswig

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] using mail() for multiple email address...

2004-03-08 Thread Adam Reiswig
Hello all, I have a strange problem with the mail() function.  It may
not be php at all.  I have multiple email accounts at my website.  I
just started testing the mail() function to learn how it works.  When I
send to multiple address' separating them via a comma, all goes well
until I send the same email to my main account and another address that
in turn redirects it to my main account.  For example:
if (mail([EMAIL PROTECTED], [EMAIL PROTECTED], test, no
body really...))
print(successful);
else
print(unsuccessful);
Normally, the two emails would end up in the same pop account but don't
seem to be when I use the above script.  If I send to one or the other
they receive appropriately, but if I send to both at the same time, I
only receive one email, not both.  If anyone can help me as to why this
is and if there is a remedy, I'd sure like to know about it.  Thanks a lot!!
-Adam Reiswig

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] using mail() for multiple email address...

2004-03-08 Thread Adam Reiswig
Hello all, I have a strange problem with the mail() function.  It may 
not be php at all.  I have multiple email accounts at my website.  I 
just started testing the mail() function to learn how it works.  When I 
send to multiple address' separating them via a comma, all goes well 
until I send the same email to my main account and another address that 
in turn redirects it to my main account.  For example:

if (mail([EMAIL PROTECTED], [EMAIL PROTECTED], test, no 
body really...))
	print(successful);
else
	print(unsuccessful);

Normally, the two emails would end up in the same pop account but don't 
seem to be when I use the above script.  If I send to one or the other 
they receive appropriately, but if I send to both at the same time, I 
only receive one email, not both.  If anyone can help me as to why this 
is and if there is a remedy, I'd sure like to know about it.  Thanks a lot!!

-Adam Reiswig

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [PHP-DB] $_POST in MySQL query issue...

2003-10-19 Thread Adam Reiswig
A couple of days ago I placed a post regarding using the $_POST[] 
variable in an insert sql query.  Both

$sql=insert into $table set Name = '.$_POST['elementName'].';
  and
$sql=insert into $table set Name = '{$_POST['elementName']}';
worked perfectly.  Thanks to everyone for your help.  My question now is 
regarding the curly brackets in the 2nd example.  Can anyone describe 
why using the curly brackets works and/or how php processes them.  I 
have read quite a bit about php and never come accross thier use in this 
way.  Thanks again.

-Adam Reiswig

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] [PHP-DB] $_POST in MySQL query issue...

2003-10-19 Thread Adam Reiswig
A couple of days ago I placed a post regarding using the $_POST[]
variable in an insert sql query.  Both
$sql=insert into $table set Name = '.$_POST['elementName'].';
  and
$sql=insert into $table set Name = '{$_POST['elementName']}';
worked perfectly.  Thanks to everyone for your help.  My question now is
regarding the curly brackets in the 2nd example.  Can anyone describe
why using the curly brackets works and/or how php processes them.  I
have read quite a bit about php and never come accross thier use in this
way.  Thanks again.
-Adam Reiswig

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] $_POST in MySQL query issue...

2003-10-16 Thread Adam Reiswig
Greetings to all.  I am trying for the life of me to place a $_POST[] 
variable in my MySQL query.  I am running the latest stable versions of 
PHP, MySQL and Apache 2 on my Win2kPro machine.  My register_globals are 
set to off in my php.ini.  My code I am attempting create is basically 
as follows:

$table=elements;
$sql=insert into $table set Name = '$elementName';
This works with register_globals set to on.  But, I want to be able to 
turn that off.  My code then, I am guessing, be something as follows:

$table=elements;
$sql=insert into $table set Name = '$_POST[elementName]';
Unfortunately this and every other combination I can think of, 
combinations of quotes that is, does not work.  I believe the source of 
the problem is the quotes within quotes within quotes. I also tried:

$sql='insert into $table set Name = '.$_POST[elementName];
  or
$sql=insert into $table set Name = .$_POST['elementName'];
and several other variations.

Can anyone give me some pointers to inserting $_POST[] statements inside 
of query statements?  I am sure there must be a way but I have spent a 
lot of time on this and am really stumped here.  Thanks for any help.

-Adam Reiswig

PS if anything here is not clear to you, please let me know and I'll 
clarify as I can.  Thanks again.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Planning a new job

2003-06-03 Thread Adam Reiswig
Tim, check out http://www.fusebox.org (there site is currently down for 
some unknown reason) and check out the FLiP cycle area.  If you are a 
PHP developer you would do well to at least use part of the methodology 
in your site development process.  Especially wireframing and 
prototypying.  They have a number of articles on both as well.

-Adam Reiswig (KliK)

Tim Burgan wrote:
Hello,

I'm wondering what processes everyone has before quoting a web programming /
design job?
Do you have a face-to-face meeting with the client?

What questions do you ask?

What information should be found-out about the job?

Do I then go away and draw up a quote? or a quote and a proposal?

Any help would be wonderful, thanks.

Tim Burgan
[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php