Re: How about a saveXHTML for the DOM?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux