How to create an XML document of fabrik detail-view template?

Are there easier ways to safe the page loadings in HTML or XML and to load them quicker?

  • Maybe the entire page can be as an RSS-feed?

    Votes: 0 0.0%
  • Maybe PDF file is loaded also faster?

    Votes: 0 0.0%
  • Maybe continue to create a custom XML file with XSL styling?

    Votes: 0 0.0%

  • Total voters
    0

marozen

Member
Loading a webpage can take a lot of time if values are loaded with php from, a large database table. I want to add php code that transforms the loaded page into a XML file. And then with XSL files you can make the page look like a HTML page. And loading it will be much faster and the file can also be loaded at other websites like an RSS-feed.

The code in the default.php template is as followed:

$xml = new DOMDocument("1.0","UTF-8");
$xml->substituteEntities = true;

$stylesheet = new DOMDocument;
$stylesheet->substituteEntities = true;
if ($stylesheet->load("https://rozendale.com/th/rad/plants.xsl") == false)
die('Failed to load XSLT file');

$xml->formatOutput=true;
$root=$xml->createElement('root');
$root->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
$root->setAttribute('xsi:noNamespaceSchemaLocation', "https://rozendale.com/th/rad/plants.xsd");

$xml->appendChild($root);

$title=$xml->createElement("title", $title);
$root->appendChild($title);

$body=$xml->createElement("body", $body);
$root->appendChild($body);

echo "<xmp>".$xml->saveXML()."</xmp>";
$xml->save("https://rozendale.com/th/rad/p$id.xml") or die("Error,Unable to create XML");

The result is an XML file with $body as an element with the entire html output of the template.

Are there easier ways to safe the page loadings in HTML or XML and to load them quicker?
 
I found another way: To save the output as html-document. And the result is that it loads much faster:

ob_start();
echo $template_content;
file_put_contents("/website/id$id.html", ob_get_contents());
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top