RE: [PHP] Classes - Dumb question
[snip] >With a class you can inherit all of the base class functionality >into a new customer type. You do not have to break open the base >class to add a case, you just have to create an extension class. >Documentation is unique to each class. No matter what, you have to break something open to add code -- if nothing else, the script. [/snip] The base class would (should?) be contained in its own script space. For instance you might have the customer class in a file called class.customer.php. You do not have to open this script to add another class or extend this class, you would just add another file like class.customerCommercial.php that extends the customer class. Since autoload is available now (http://www.php.net/autoload) you would not even have to open the 'calling' script to add an include line. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes - Dumb question
On 10/15/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: > > [snip] > >With a class you can inherit all of the base class functionality > >into a new customer type. You do not have to break open the base > >class to add a case, you just have to create an extension class. > >Documentation is unique to each class. > > No matter what, you have to break something open to add code -- if > nothing else, the script. > [/snip] > > The base class would (should?) be contained in its own script space. For > instance you might have the customer class in a file called > class.customer.php. You do not have to open this script to add another > class or extend this class, you would just add another file like > class.customerCommercial.php that extends the customer class. Since > autoload is available now (http://www.php.net/autoload) you would not even > have to open the 'calling' script to add an include line. > furthermore using a delegation technique like Stut demonstrated, you may not even need to edit a file to instantiate the class and call a method. -nathan
[PHP] please advise
Sorry... meant to send this to the list -- Forwarded message -- From: Philip Thompson <[EMAIL PROTECTED]> Date: Oct 15, 2007 9:47 AM Subject: Re: [PHP] please advise To: Louise Sanders <[EMAIL PROTECTED]> On 10/15/07, Louise Sanders <[EMAIL PROTECTED]> wrote: > > Hi There > > I am totally new to PHP and have just tried installing it on my machine > according to instructions on the php.net manual installation instructions > page - http://www.php.net/manual/en/install.windows.manual.php > > I think I managed to do most steps but I have a few questions: > > Under the PHP file, I have icons for php, php-win and php-cgi. If I > double > click on any one of them, it says - "Are you sure you want to run this > software?" I have Windows Vista - 32 bit operating system and have > installed IIS7. Which one would you recommend that I run? Then, how do I > know that everything is installed properly? Make sure you read the specific steps for installing on Windows ( http://www.php.net/manual/en/install.windows.manual.php) and IIS (http://www.php.net/manual/en/install.windows.iis.php). To get running with IIS (or any other web server), you need to verify that your settings are correct and the web server knows that PHP actually exists on the machine. To verify that it's installed properly, put this file on your web server... If you get "Hello World" (w/o quotes) on that page when you visit it, you know it's working. Under optional steps: > > How do I change the doc_root to point to the web servers document_root?? > This was an optional step but not sure how to do this? (sorry basic > question!) and what extensions would you recommend that I install? This is a php.ini file setting. Look for the line that says: doc_root = For a Windows installation, you will want it to look something like: doc_root = C:\Inetpub\wwwroot Of course, if you set your web server's document root to a different location, you'll want to reflect that in this line. I look forward to any advice! > > Many Thanks > > Louise > > (South Africa) Good luck. ~Philip
Re: [PHP] please advise
Dear Pal, As a PHP Programmer, I will advice you to go for an Application called WAMP which is the combination of MS WINDOWS PLATFORM, APACHE WEBSERVER, MYSQL DATABASE and PHP as Language. I have been working with this application and have used it in developing different applications on PHP platform. You can get WAMP(WINDOWS,APACHE,MYSQL,PHP) from the following link with the related docs on how to use and operate it very well. WAMP links: www.wampserver.com/en/download.php en.wikipedia.org/wiki/WAMP www.puremango.co.uk/cm_wamp_97.php If you need any other asssitance, do not hesistate to Contact me. Williams Dare - Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
Re: [PHP] HTML Parse Issue
[EMAIL PROTECTED] wrote: I am having a issue parsing an html file. I want to pull all the data between two html tags. Problem I am having is that no matter what I try I can pull either tag or both but not the data in between. Welcome to Rideon function datamatch($document) { preg_match_all('/]*>(.*)/<\/div class="record" [^<>]*>/i',$document,$elements); $match = implode("\r\n",$elements[0]); return $match; } This should return the following Welcome to Rideon Welcome to Rideon #1 Welcome to Rideon #2 Welcome to Rideon #3 Welcome to Rideon #4 '; if ( preg_match_all('!class="rideon">([^<]+)!', $data, $matches, PREG_SET_ORDER) ) { print_r($matches); } else { echo 'Could not match anything.'; } -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing Strings
Hi. Before I try and reinvent the wheel, I thought I'd query the list. I want to take this string: thisIsAStringIHave and turn it into: This Is A String I Have Essentially, I want to capitalize the first letter (ucfirst) and then put a space in front of each uppercase letter. I didn't find a PHP function that did this (but maybe I didn't look diligently enough). My idea to accomplish this is to create an array of capital letters. Then iterate through each letter in the string. If a letter in the string matches a letter in the array of capital letters, replace that letter with a space + that letter. Is there a better way than brute-forcing this?? =D Thanks in advance, ~Philip
Re: [PHP] Parsing Strings
On 10/15/07, Philip Thompson <[EMAIL PROTECTED]> wrote: > Hi. > > Before I try and reinvent the wheel, I thought I'd query the list. I want to > take this string: > > thisIsAStringIHave > > and turn it into: > > This Is A String I Have > > Essentially, I want to capitalize the first letter (ucfirst) and then put a > space in front of each uppercase letter. I didn't find a PHP function that > did this (but maybe I didn't look diligently enough). How about this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing Strings
Philip Thompson wrote: > ... HTH -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing Strings
On 10/15/07, Richard Heyes <[EMAIL PROTECTED]> wrote: > > Philip Thompson wrote: > > ... > > $str = 'thisIsAStringIHave'; > > echo ucfirst(preg_replace('/([A-Z])/', ' $1', $str)); > ?> > > HTH Ha! I knew there was a much easier way. My brain is still not working this Monday morning need... more... caf... feine Thanks!! ~Philip
RE: [PHP] Classes - Dumb question
At 5:42 AM -0500 10/15/07, Jay Blanchard wrote: [snip] With a class you can inherit all of the base class functionality into a new customer type. You do not have to break open the base class to add a case, you just have to create an extension class. Documentation is unique to each class. No matter what, you have to break something open to add code -- if nothing else, the script. [/snip] The base class would (should?) be contained in its own script space. For instance you might have the customer class in a file called class.customer.php. You do not have to open this script to add another class or extend this class, you would just add another file like class.customerCommercial.php that extends the customer class. Since autoload is available now (http://www.php.net/autoload) you would not even have to open the 'calling' script to add an include line. I understand the class concept. But, I am not familiar with autoload. Stut also made mention of that, so I shall investigate post haste. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes - Dumb question
On 10/15/07, tedd <[EMAIL PROTECTED]> wrote: > > I understand the class concept. But, I am not familiar with autoload. > > Stut also made mention of that, so I shall investigate post haste. __autoload is pretty tight; but if you dont want to have all your class files in the same directory, i suggest you implement something custom. ive seen several implementations where class names basically have filesystem paths embedded in them; ugh.. i think thats what those buxa project guys are doing, but im not certain. also, the __autoload() function has to be available for it to be called, which means you will have to include the file that defines it in every file that would use it. since my php code is heavily oop; i just use the php.ini auto_prepend_file directive. oh; btw, Tedd, autoload is for classes only; if you like what you see maybe that will be the excuse youve been looking for to get into oop w/ php :) -nathan
[PHP] Two MySQL instances in one server
Hi all, Would it be possible to have two MySQL instances running on one server (each having different ports) and then have only one running Apache server with PHP? I have tried this once but PHP can only connect to one MySQL server because it can only read one socket file at a time. As much as possible, I would prefer a purely mod_php solution as opposed to one that would have PHP running on CGI. Thanks in advance, Matt -- Stand before it and there is no beginning. Follow it and there is no end. Stay with the ancient Tao, Move with the present. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Two MySQL instances in one server
On 10/15/07, Matt Arnilo S. Baluyos (Mailing Lists) <[EMAIL PROTECTED]> wrote: > I have tried this once but PHP can only connect to one MySQL server > because it can only read one socket file at a time. are you sure? I am using multiple datasources (not socket ones) but I see absolutely no reason there would be a limit. Are you sure you had all the right paths? I run multiple mysql instances on each of my mysql servers - each client of mine has their own. I use mysqlmanager as the angel process to manage them, restart them, etc. It's included in MySQL 5.x nowadays. much better than having to tweak initscripts. But it can easily be done from both sides. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Parse Issue
Jim Lucas wrote: [EMAIL PROTECTED] wrote: I am having a issue parsing an html file. I want to pull all the data between two html tags. Problem I am having is that no matter what I try I can pull either tag or both but not the data in between. Welcome to Rideon function datamatch($document) { preg_match_all('/]*>(.*)/<\/div class="record" [^<>]*>/i',$document,$elements); $match = implode("\r\n",$elements[0]); return $match; } This should return the following Welcome to Rideon Welcome to Rideon #1 Welcome to Rideon #2 Welcome to Rideon #3 Welcome to Rideon #4 '; if ( preg_match_all('!class="rideon">([^<]+)!', $data, $matches, PREG_SET_ORDER) ) { print_r($matches); } else { echo 'Could not match anything.'; } I just realized a problem with this code. You have tabs/spaces/new lines between your different tags, so my regx needs a little modification Try this instead: Welcome to Rideon #1 Welcome to Rideon #2 Welcome to Rideon #3 Welcome to Rideon #4 '; if ( preg_match_all('!\s*class="rideon">\s*\s*([^<]+)\s*\s*\s*!', $data, $matches, PREG_SET_ORDER) ) { print_r($matches); } else { echo 'Could not match anything.'; } -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes - Dumb question
On Monday 15 October 2007, Nathan Nobbe wrote: > On 10/15/07, tedd <[EMAIL PROTECTED]> wrote: > > I understand the class concept. But, I am not familiar with autoload. > > > > Stut also made mention of that, so I shall investigate post haste. > > __autoload is pretty tight; but if you dont want to have all your class > files in the same > directory, i suggest you implement something custom. > ive seen several implementations where class names basically have > filesystem paths > embedded in them; ugh.. i think thats what those buxa project guys are > doing, but im > not certain. > also, the __autoload() function has to be available for it to be called, > which means you > will have to include the file that defines it in every file that would use > it. since my php > code is heavily oop; i just use the php.ini auto_prepend_file directive. > oh; btw, Tedd, autoload is for classes only; if you like what you see maybe > that will be > the excuse youve been looking for to get into oop w/ php :) > > -nathan __autoload() is also not recommended. :-) You can only have one per script. Instead, use spl_autoload_register(). That way you can stack multiple autoload routines cleanly. (At least that's what the php-internals folks were saying the last time the topic came up.) http://us2.php.net/manual/en/function.spl-autoload-register.php -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes - Dumb question
On 10/15/07, Larry Garfield <[EMAIL PROTECTED]> wrote: > > On Monday 15 October 2007, Nathan Nobbe wrote: > > On 10/15/07, tedd <[EMAIL PROTECTED]> wrote: > > > I understand the class concept. But, I am not familiar with autoload. > > > > > > Stut also made mention of that, so I shall investigate post haste. > > > > __autoload is pretty tight; but if you dont want to have all your class > > files in the same > > directory, i suggest you implement something custom. > > ive seen several implementations where class names basically have > > filesystem paths > > embedded in them; ugh.. i think thats what those buxa project guys are > > doing, but im > > not certain. > > also, the __autoload() function has to be available for it to be called, > > which means you > > will have to include the file that defines it in every file that would > use > > it. since my php > > code is heavily oop; i just use the php.ini auto_prepend_file directive. > > oh; btw, Tedd, autoload is for classes only; if you like what you see > maybe > > that will be > > the excuse youve been looking for to get into oop w/ php :) > > > > -nathan > > __autoload() is also not recommended. :-) You can only have one per > script. > Instead, use spl_autoload_register(). That way you can stack multiple > autoload routines cleanly. > > (At least that's what the php-internals folks were saying the last time > the > topic came up.) > > http://us2.php.net/manual/en/function.spl-autoload-register.php > neat; i didnt know about that, but i had checked out spl_autoload() before. ive defined a singleton that has a method for loading of classpaths. when __autoload is called, it delegates to the singleton to see if the classpath is valid. if theres a match it loads it, otherwise it chokes. i cant imagine having multiple __autoload methods, but perhaps if there was a third party lib that was also using autoload() theirs could be stacked on top of yours and that way they could both live together. i might give that a shot. -nathan
Re: [PHP] A two flavored post
i was just working on some stuff and remembered how ive handled a problem like this in the past. the issue you have to wrestle w/ is the anchor tag will perform its normal behavior after the onclick handler has finished executing. basically, onclick is just part of the process for the anchor tag. well, what ive done in the past is determined, its only a link if you think its a link :) so i just toss some css on a span tag to make it look like a link, then you get full control over the onclick behavior. heres some sample css: /* anchor imitator */ span.anchorImitator { font-size: 11px; font-family: Verdana,Arial,Helvetica,san-serif; font-weight: 400; color: #1505A5; text-decoration: none; } span.anchorImitator:hover { cursor:pointer; font-size: 11px; font-family: Verdana,Arial,Helvetica,san-serif; font-weight: 400; color: #AEF3F9; text-decoration: underline; } of course it wont do much w/o javascript enabled. -nathan
Re: [PHP] Screenshot from web page
Gevorg Harutyunyan escribió: Hi, I would like to make web page screenshot and generate an image for example .jpg or .png using PHP,Apache. If any one has experiance in doing that please help. I know that there are lot of services like that, but I don't want to use them. In real I need that to generate screenshot of my local server pages. There is a firefox extension called "screengrab" to do just that... The results are, well, perfect! the URL is: https://addons.mozilla.org/es-ES/firefox/addon/1146 -- .---. | Miguel J. Jiménez | | Programador Senior| | Área de Internet | | [EMAIL PROTECTED]| :---: | ISOTROL, S.A. | | Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta. | | Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP). | | Teléfono: +34 955 036 800 (ext.1805) - Fax: +34 955 036 849 | | http://www.isotrol.com| :---: | "Una bandera une a los habitantes de un pais bajo unos ideales| | comunes y es por eso por lo que todos ellos deben aceptarlos de | | buena gana y no ser forzados a ello pues entonces dicha bandera | | no serviría de nada." - Emperador Ming, Flash Gordon (1x07)(2007) | '---' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php