mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
- new methods parse and p (for print) : enable PhpWebGallery pages to be
fully generated before being send to browser git-svn-id: http://piwigo.org/svn/trunk@687 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -55,6 +55,9 @@ class Template {
|
||||
|
||||
// This will hold the uncompiled code for that handle.
|
||||
var $uncompiled_code = array();
|
||||
|
||||
// output
|
||||
var $output = '';
|
||||
|
||||
/**
|
||||
* Constructor. Simply sets the root dir.
|
||||
@@ -133,6 +136,39 @@ class Template {
|
||||
eval($this->compiled_code[$handle]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* fills $output template var
|
||||
*/
|
||||
function parse($handle)
|
||||
{
|
||||
if (!$this->loadfile($handle))
|
||||
{
|
||||
die("Template->pparse(): Couldn't load template file for handle $handle");
|
||||
}
|
||||
|
||||
// actually compile the template now.
|
||||
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
|
||||
{
|
||||
// Actually compile the code now.
|
||||
$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle], true, '_str');
|
||||
}
|
||||
|
||||
// Run the compiled code.
|
||||
$_str = '';
|
||||
eval($this->compiled_code[$handle]);
|
||||
$this->output.= $_str;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* prints $output template var
|
||||
*/
|
||||
function p()
|
||||
{
|
||||
echo $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the uncompiled code for $handle as the value of $varname in the
|
||||
|
||||
Reference in New Issue
Block a user