[PHP] Classes and access to outside variables

2007-09-29 Thread Merlin
Hi there, I am new to PHP classes and I do want to access a variable outside the class, but somehow that does not work. global also does not have any effect. In the following example I would like to be able to access $dbh from inside the class like I did in that example. This does not work. C

Re: [PHP] Classes and access to outside variables

2007-09-29 Thread Martin Alterisio
Refer to the global on the constructor. Anyway, using a global like that is not a good practice. Just pass the variable to the constructor. 2007/9/29, Merlin <[EMAIL PROTECTED]>: > > Hi there, > > I am new to PHP classes and I do want to access a variable outside the > class, but somehow that doe

Re: [PHP] Re: languages and PHP

2007-09-29 Thread tedd
At 12:36 PM -0500 9/28/07, Edward Vermillion wrote: My question was more mental prodding than anything else. The OP had a function to convert incoming text into UTF-8 before they did anything with it. A couple of folks said that was unnecessary, if you set your form to UTF-8 your incoming data

Re: [PHP] Classes and access to outside variables

2007-09-29 Thread Nathan Nobbe
Merlin, if you are using php5 the var keyword is no longer valid; that was used in classes in php4. if you want to structure your classes properly you need to study PPP (public, private, protected) access modifiers. typically member variables are declared to be private or protected, if there will

[PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Jeff Cohan
Yes, I know how to Google, and I've been Googling... But I would appreciate advice about good beginner tutorials using classes in PHP4 based on your actual experiences. I.e., have some of you found tutorials that really unlocked the doors for you? Ideally, such tutorials would have somewhat reali

Re: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Greg Maruszeczka
Jeff Cohan wrote: > Yes, I know how to Google, and I've been Googling... > > But I would appreciate advice about good beginner tutorials using > classes in PHP4 based on your actual experiences. I.e., have some of > you found tutorials that really unlocked the doors for you? > > Ideally, such tut

Re: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Jeff Cohan
Greg - Greg Maruszeczka wrote: > Jeff: > The following books really helped me get my head around basic > OOP and design patterns in PHP, especially the first one > which directly addresses both PHP4 and PHP5: > > 1. PHP Architect's Guide to PHP Design Patterns, Jason E. > Sweat, PHP Architect

RE: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Instruct ICC
> From: [EMAIL PROTECTED] > Today's post was > prompted by my desire to prototype yet another suite of > browse-read-edit-add-delete functions for someone. I was just going to ask you what is BREAD. Cool, basically a Web-based CRUD? I can't find anything on it, can you point me to some sites?

Re: [PHP] Classes and access to outside variables

2007-09-29 Thread Nathan Nobbe
On 9/30/07, 潘志彬 <[EMAIL PROTECTED]> wrote: > > $dbh = 'test'; > > class search_helper extends AjaxACApplication > { > /** > * Database connection details > */ > >// announce global variable before use it >global $dbh; > > $db_hostname = $dbh;

Re: [PHP] Classes and access to outside variables

2007-09-29 Thread 潘志彬
$dbh = 'test'; class search_helper extends AjaxACApplication { /** * Database connection details */ // announce global variable before use it global $dbh; $db_hostname = $dbh; ... Regards, Ryu 2007/9/29, Merlin <[EMAIL PROTECTED]>:

Re: [PHP] counting with leading zeros

2007-09-29 Thread brian
tedd wrote: At 8:30 PM -0400 9/27/07, brian wrote: I wasn't bitching! And i *thought* that my numerous attempts at explaining such would have been enough. Obviously not, but wtf can you do with people who seem to want only to stir up shit? It sure sounded like you were bitching. Gee, thanks

Re: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Nathan Nobbe
although some people believe differently than i; i would argue trying to learn how to design w/ the classes that php4 provides is a waste of time. most books you will find regarding object oriented design assume the language has the basic constructs. ppp mainly. also, there are other important fa

Re: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Nathan Nobbe
painfully i find myself bound to it at my current job. there ive been able to realize that proper oop can be used to an amazing extent in php4, however altogether i wish we could just move on to 5 and i could stop writing in // private as a comment :) -nathan On 9/30/07, Jeff Cohan <[EMAIL PROTE

Re: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Jeff Cohan
Nathan Nobbe wrote: > > although some people believe differently than i; i would argue > trying to learn how to design w/ the classes that php4 provides > is a waste of time. most books you will find regarding object oriented > design assume the language has the basic constructs. ppp mainly. > a

Re: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-09-29 Thread Jeff Cohan
Instruct ICC wrote: > > From: [EMAIL PROTECTED] > > Today's post was > > prompted by my desire to prototype yet another suite of > > browse-read-edit-add-delete functions for someone. > > I was just going to ask you what is BREAD. Cool, basically a > Web-based CRUD? I can't find anything on it,