Tuesday 27 February 2007 8:05:15 pm
Nicklas, One idea: Use eZ to generate PHP and have a cronjob write it to a file. Because the content is placed in a PHP file, it is still dynamic, but extracting it out of eZ removes some overhead. This isn't a simple solution. The basic idea is to create a template that delivers PHP and then call it, through eZ, with a PHP script and write it to a file. This is just a different way of caching - and it allows you full control of the PHP. By removing it from eZ, you remove any template caching overhead. The code below uses pagelayout to determine whether to deliver the PHP template, which is stripped of headers, etc, or the normal page. A better solution would be an alternate siteaccess, where the whole siteaccess delivers {$module_result.content} without surrounding code/HTML. I hope this helps. I did use this to support a site that had to withstand burst traffic, where many visitors arrived in a short time-frame. I have found it is usually easier to get information out of eZ using templates - even using templates to write CSV files, than using PHP. Your PHP code, could write additional PHP code - and use a cronjob or other mechanism to trigger a refresh. Good luck. Template to build PHP
{* Builds PHP to make faster templates *}
<!-- START MAKE PHP OUTPUT -->
<?php
... all the logic to generate the values to support your PHP would go here ...
... this is just sample PHP (after the literal tag) ... yours would be different
{literal}
import_request_variables("gp", "rvar_");
$node = $rvar_node;
$node_name='_'.$node;
echo <<< END
<style type="text/css">
<!--
a {text-decoration:none}
body {background: transparent; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; background: transparent;
margin: 0; color: #666;}
-->
</style>
END;
if (count($$node_name)==0)
echo 'No<br>';
else
foreach($$node_name as $v)echo $v.'<br>';
?><!-- END MAKE PHP OUTPUT -->
{/literal}
<b>pagelayout.tpl</b>
{let time_class=fetch( 'class', 'list', hash( 'class_filter', array( 'php' ) ) )}
{section show=$module_result.content_info.class_id|ne($php.0.id)}
... This is the code that delivers the normal site pages
{section-else}
... This is the code that delivers the PHP pages.
{literal}
<style type="text/css">
<!--
a {text-decoration:none}
body {font-family: Arial, Helvetica, sans-serif; font-size: 0.6em; background: transparent; margin: 5; color: #666
;}
-->
</style>
{/literal}
<body>
{$module_result.content}
</body>
{/section}
<b>build.php</b>
<?php
$url="http://".$domain.".example.com/ez/index.php/plain/".$make_php_urlalias;
$handle=@fopen($url,"rb");
/* $handle can then be used to read the PHP and write it out */
<b>cronjob</b> executes this command
/usr/local/bin/php -C www/admin/build.php business
I apologize if I misunderstood your request. The idea of this approach is to use eZ to write the PHP that can deliver some eZ content.
|