Prev: array or list of objects of different types
Next: Collections / Static typing - was "array or list of objectsof different types"
From: "Peter Pei" on 3 Apr 2010 10:22 >> > > > 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 upon a time, Opera was so broken, and it also showed you that little window for ads ;-) I love to see opera get a chance, but its market share is not moving even with the release Opera 10. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Ashley Sheridan on 3 Apr 2010 11:17 On Sat, 2010-04-03 at 17:03 +0200, dispy wrote: > Am 03.04.2010 16:29, schrieb tedd: > > 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 class="question"> > > Who is Roger Rabbit? > > </p> > > > > My question is -- how can I extract the string "Who is Roger Rabbit?" > > from each page using php? You see, I want to store the questions in a > > database without having to re-type, or cut/paste, each one. > > > > Now, I can extract each question by using javascript -- > > > > document.getElementById("question").innerHTML; > > > > -- and stepping through each page, but I don't want to use javascript > > for this. > > > > I have not found/created a working example of this using PHP. I tried > > using PHP's getElementByID(), but that requires the target file to be > > valid xml and the string to be contained within an ID and not a class. > > These pages do not support either requirement. > > > > Additionally, I realize that I can load the files and parse out what is > > between the <p> tags, but I was hoping for a "GetElementByClass" way to > > do this. > > > > So, is there one? > > > > Thanks, > > > > tedd > > 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: > /\<p\s*class\=\"question\"\s*\>(.*)\<\/p\> > > > (my first contribute here, I beg your pardon if something went wrong) > > Regards, > > Valentin Dreismann > The . won't match new line characters, so you'll have to add those in too. Thanks, Ash http://www.ashleysheridan.co.uk
From: "Peter Pei" on 3 Apr 2010 10:23 > > 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: > /\<p\s*class\=\"question\"\s*\>(.*)\<\/p\> > > > (my first contribute here, I beg your pardon if something went wrong) > > Regards, > > Valentin Dreismann > regexp is the best fit here and not much effort to do. Especially consider this is only for one time use. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: "Peter Pei" on 3 Apr 2010 10:26 >> >> 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 even need to download just plug the link in. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Ashley Sheridan on 3 Apr 2010 11:21
On Sat, 2010-04-03 at 08:22 -0600, Peter Pei wrote: > >> > > > > > > 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 upon a time, Opera was so broken, and it also > showed you that little window for ads ;-) > > I love to see opera get a chance, but its market share is not moving even > with the release Opera 10. Opera has led the way in most things over the years. It was the first browser to have addons, first browser to have tabs, first to have that odd homepage with thumbnails of your 9 most popular sites. Thanks, Ash http://www.ashleysheridan.co.uk |