Re: How about a saveXHTML for the DOM?
| From: | Michael A. Peters | Date: | Sun, 12 Apr 2009 03:36:56 +0000 |
| Subject: | Re: How about a saveXHTML for the DOM? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291381@lists.php.net to get a copy of this message | ||
Michael A. Peters wrote:
With respect to templating systems, I don't use them but if you have a DOMDocument orientated template system, I don't see why it couldn't do the same thing -As an experiment, I took one of my pages that was a little sluggish due to lots of database calls (sluggish on my home machine anyway) - since the database content rarely changes for the data presented, I made a page I can grab nightly in cron that spits out just the main content div where all the DB calls are made. -=- $cached = 'species_cache.php'; $SL = file_get_contents($cached); $SDOM = new DOMDocument("1.0","UTF-8"); $SDOM->loadXML($SL); $elements = $SDOM->getElementsByTagName("div"); $imported_div = $elements->item(0); $contentDiv = $myxhtml->importNode($imported_div,true); -=- species_cache.php is just a text file with a div and all it's children. Sped up the page considerably on my home machine, and works spledidly regardless of whether or not I am sending it as html or xhtml. So I think my technique would work with template systems.