Re: [PHP] Re: Constructor usage

2010-04-05 Thread Peter Pei
On Sun, 04 Apr 2010 17:46:19 -0600, Nathan Rixham nrix...@gmail.com wrote: Larry Garfield wrote: Hi folks. Somewhat philosophical question here. I have heard, although not confirmed, that the trend in the Java world in the past several years has been away from constructors. That is,

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
On Sat, 03 Apr 2010 08:58:44 -0600, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sat, 2010-04-03 at 10:29 -0400, tedd wrote: Hi gang: Here's the problem. I have 184 HTML pages in a directory and each page contain a question. The question is noted in the HTML DOM like so: p

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
No javascript's getElementByID() won't work here. As question is a class, not an ID. But like what was mentioned here, you can use getElementByClass() with Opera, and that will work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
Yes, because Opera is pretty much leading the way with its HTML5 support. Not even Firefox supports as much as Opera does. Thanks, Ash http://www.ashleysheridan.co.uk Opera 10.10 is a very nice version, but 10.50 could be quite slow with some web pages. I still remember that once

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
Why don't you just use REGEX? I don't know any possibility to easily process contents which are not valid XML/XHTML just because there's no library to load such stuff (but put me in right there). I'm not an expert of REGEX, but I think the following would do it:

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
Hi You could replace the class with id and then go on with JavaScript. A possible better way are regular expressions... Greetz Piero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yes, and jquery is hosted on Microsoft CDN, don't

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
I think Tedds main reason not to use Javascript is that he needs it to be done on the server rather than the client machine. ps. please use bottom posting on the list. Thanks, Ash http://www.ashleysheridan.co.uk But he also mentioned that he wanted to avoid copy and paste... it does

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
On Sat, 03 Apr 2010 09:21:17 -0600, Ashley Sheridan a...@ashleysheridan.co.uk wrote: s, first browser to have tabs, first to have that odd homepage with thumbnails of y Talking about Opera's 'speed dial... I downloaded safari yesterday (which I didn't like last time I used it), it now has

Re: [PHP] Re: array or list of objects of different types

2010-04-03 Thread Peter Pei
var_dump( array( true , 12 , php already does this ) ); array(3) { [0]= bool(true) [1]= int(12) [2]= string(21) php already does this } :) Yeah. But this feature of PHP is a boon if used carefully and a curse if careless. You can get AMAZING results if you're not careful to

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
Somejavascript engine already support GetElementByClass, for example Opera does. My example shows how, namely: document.getElementById(question).innerHTML; will return the value within the class. Cheers, tedd In your original post, you said the data you had was: p class=question

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
Sort of. Like I said, the folling will work: document.getElementById(question).innerHTML; While you are using a getElementById, which returns an ID, but adding .innerHTML will return the class value. Try it. Cheers, tedd No, this will not work, if it appeared working, please re-check

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
It might have worked in Internet Explorer, as for a while that browser got confused over the class and id if two different elements on a page had the same class and id values. Thanks, Ash http://www.ashleysheridan.co.uk IE and Opera were the two I tested with. -- Using Opera's

Re: [PHP] GetElementByClass?

2010-04-03 Thread Peter Pei
?php // here is where you load a single file or change to iterate over a // directory of files $oDomDoc = DOMDocument::loadHTMLFile('./tedd.html'); // here is where you search for the question sections of each file $oDomXpath = new DOMXPath($oDomDoc); $oNodeList =

Re: [PHP] Collections / Static typing - was array or list of objects of different types

2010-04-03 Thread Peter Pei
On Sat, 03 Apr 2010 11:30:36 -0600, Nathan Rixham nrix...@gmail.com wrote: them in a google code project or suchlike. They'll obviously never be as fast as Java/C but they do allow for static typing of collections using primitive types That will be wonderful. -- Using Opera's revolutionary

[PHP] SimpleXMLElement and gb2312 or big5

2010-04-02 Thread Peter Pei
I use the following code to get rss and parse it, but the code occasionally have issues with gb2312 or big-5 encoded feeds, and fails to parse them. However other times may appear just okay. Any thoughts? Maybe SimpleXMLElement is simply not meant for other language encodings...

[PHP] SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds

2010-04-02 Thread Peter Pei
I use the following code to get rss and parse it, but the code occasionally have issues with gb2312 or big-5 encoded feeds, and fails to parse them. However other times may appear just okay. Any thoughts? Maybe SimpleXMLElement is simply not meant for other language encodings...