PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Template_Xipe » Bug #265

cache with HTML_Template_Xipe doesnt work in functions

Details

Submitted2003-11-18 02:46 UTC
Fromkonrek at gmx dot net
Assignedcain
StatusSuspended
PackageHTML_Template_Xipe
PHP VersionIrrelevant
OSlinux, PHP 4.2
Roadmaps(Not assigned)

Comments

[2003-11-18 02:46 UTC] konrek at gmx dot net

Description:
------------
calling include() in fct causes error (works in global scope):

Fatal error: Call to a member function on a non-object in /home/kostja00/public_html/docserv/browsing/test/tmp/ template_test.tpl.en.php on line 12

line 12:
<?php $_2f9c40105e256a4b38ac6ca4b2810af2->_cacheEnd() ?>

Reproduce code:
---------------
function tpl()
{
global $tpl;
$options = array( 'templateDir' => dirname( __FILE__ ), 'enable-Cache'=> TRUE ,
'debug' => 1, 'filterLevel' => 8, 'forceCompile' => TRUE,
'enable-XMLConfig' => true );
/* 'autoBraces' => false */
$tpl = new HTML_Template_Xipe( $options );

if ( !$tpl->isCached('include.tpl' )) {

print 'CACHE MISS, GENERATING CACHE FILE NOW!';
}

$tpl->compile( 'include.tpl' );
include( $tpl->getCompiledTemplate() );
$tpl->compile( 'template_test.tpl' );
include( $tpl->getCompiledTemplate() );

trigger_error('This is an information log message.', E_USER_NOTICE);
$tpl->compile( 'include_end.tpl' );
include( $tpl->getCompiledTemplate() );
}// end function

tpl();
//---------------------------------
template-test.php:

<HTML_Template_Xipe>
<options>
<cache>
<time value="10" />
</cache>
</options>
</HTML_Template_Xipe>

<!-- { include_once('include.tpl')} funktioniert auch-->
some links more more cache-time
{foreach( $list as $l ) }
<li>{$l}</li>

<br />
{%trim $text 5 "..."%}
<br />
{%repeat 3%}
repeat me

[2003-11-19 12:12 UTC] konrek at gmx dot net

Fixed the bug, in Cache.php set Cache._enableCaching() the
the cache-object-call wich appears at the very end of templates <?php } $_e3423(somemd5some)->_cacheEnd() ?> to
<?php } $GLOBALS["_e3423(somemd5some)"]->_cacheEnd() ?>