Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/index-old.php
diff options
context:
space:
mode:
authorBernie Innocenti <bernie@codewiz.org>2011-03-01 00:55:41 (GMT)
committer Bernie Innocenti <bernie@codewiz.org>2011-03-01 00:55:41 (GMT)
commit64474c14afdb45961cd232d30cc443f0c318f292 (patch)
tree5b2e7102550544b48a1fd1e52548b6082dabd2a3 /index-old.php
Sugar Labs website 2010
Diffstat (limited to 'index-old.php')
-rwxr-xr-xindex-old.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/index-old.php b/index-old.php
new file mode 100755
index 0000000..c20c7ee
--- /dev/null
+++ b/index-old.php
@@ -0,0 +1,43 @@
+<?php
+
+ $xslfilename = 'index';
+ if (isset($_GET['template'])) {
+ $xslfilename = ctype_alpha($_GET['template']) ? $_GET['template'] : 'index';
+ }
+
+ // get additional arguments
+ $arguments = array(
+ 'page' => $_GET['page'],
+ 'article' => $_GET['article'],
+ 'language' => $_GET['language']
+ );
+ $page = $_GET['page'];
+ $article = $_GET['article'];
+ $language = $_GET['language'];
+ $cached_name = "cache/$xslfilename$page$article$language.xml";
+
+ // does a cached version exist?
+ if (file_exists($cached_name)) {
+ readfile($cached_name);
+ } else {
+ // load the xml file and stylesheet as domdocuments
+ $xsl = new DomDocument();
+ $xsl->load("xsl/$xslfilename.xsl");
+
+ $xml = new DomDocument();
+ $xml->load("xml/index.xml");
+ $xml->Xinclude();
+
+ // create the processor and import the stylesheet
+ $proc = new XsltProcessor();
+ $xsl = $proc->importStylesheet($xsl);
+ $proc->setParameter(null, $arguments);
+
+ // transform and output the xml document, caching result
+ $output = $proc->transformToDoc($xml)->saveXML();
+
+ // enable this line on server to enable caching
+ file_put_contents($cached_name, $output);
+ print $output;
+ }
+?> \ No newline at end of file