NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP html DOM manipulation

John Campbell jcampbell1 at gmail.com
Sun Aug 7 23:53:00 EDT 2011


On Fri, Aug 5, 2011 at 6:39 PM, Gary Mort <garyamort at gmail.com> wrote:
> 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.]

This sounds like premature optimization to me.  How can you make a
lightbox with PHP code?  Doesn't even make sense.  Sure PHP can run
selectors and maybe change attributes, but it can't bind an event to
the DOM.

If you want better performance, maybe event delegation in javascript
is a better solution.  See the jQuery docs for "live"

-John Campbell



More information about the talk mailing list