[nycphp-talk] PHP html DOM manipulation
Mark Armendariz
lists at enobrev.com
Fri Aug 5 19:11:42 EDT 2011
Personally, I'm a fan of SimpleHTMLDOM,
http://simplehtmldom.sourceforge.net/, which has a great interface, but
uses string parsing instead of DOM.
I haven't had much experience with these others:
phpQuery: http://code.google.com/p/phpquery/
Zend_Dom: http://framework.zend.com/manual/en/zend.dom.html
QueryPath: http://querypath.org/
FluentDOM: http://www.fluentdom.org/
That said, if you're trying to replace simple javascript functionality
for anything besides parsing HTML, I might argue that you might not be
doing enough javascript. I don't know your client(s) / empoyer(s) /
project(s), but I've found in the past 2+ years that I could do so much
more in javascript and keep php in the back for the heavier lifting and
data access. The recent flourishing of interesting javascript-heavy
sites has essentially guaranteed javascript is enabled on most
browsers. I recently released a javascript-heavy site that is accessed
by tens of thousands of non-technical people every day and there
haven't been any complaints (besides the occasional javascript bug that
buzzed past my tests).
Of course, that always depends on your market. Accessibility is a
serious js-heavy issue. And some sites need to be js-light for
backwards compatibility (banks and other such institutions come to
mind). But if those specific cases aren't in your way, I might
recommend getting cozier with JS instead of trying to replace it with
PHP. It's not the toy language of the early 00's, but rather an
advanced and fast front-end language that has finally grown into its
potential - and arguably the most popular language in the world.
Mark
On 08/05/2011 06:39 PM, Gary Mort wrote:
> I was wondering what the current favorites are for PHP html DOM
> manipulation are.
>
> I ran across one library which basically took all the JQuery DOM
> functions and created PHP equivalents for them - so you can do things
> like find all the elements of a certain tag class or type and replace
> their html with something else.
>
> One thing I'd like to see this for is to re-write all those cool
> lightbox style javascript codes into PHP code[so instead of the user
> waiting for all the HTML to download, then waiting for a javascript
> event to trigger to update the links from their old links to popup
> links if they have the appropriate class - the server can pre-process
> the file and do those substitutions once and then cache the data.]
>
>
>
>
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
More information about the talk
mailing list