I haven't tested, but I think it is simply a matter of changing call to _tpl_include() to add 2nd param of true in INCLUDE code in template_inc.php.
Inclusion now rather than later, should mean that we can rely on <!-- INCLUDE for 10 rather than having to still use the hack. (Will still need to include hack in templates coded for 9.2.x in case running on earlier version).
Most of the times you wont need to include the same template over and over, so it will include_once. Simply add false to the parameters list and it should work.
.:: I met php the 03 December 2003 :: Unforgettable day! ::.
Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.7 / PHP 7.3 / head
Any template which repeats can encounter this issue. How to I add false to <!-- INCLUDE pronews/pn_art_foot.html --> ? I.e what is the syntax for parameters? <!-- INCLUDE pronews/pn_art_foot.html false --> stops it working for even the first one. Ditto <!-- INCLUDE pronews/pn_art_foot.html $include='false' -->
<!-- BEGIN something -->
<!-- IF SHOWPICTURE -->
!-- INCLUDE pronews/pn_art_foot.html false -->
<!-- ENDIF -->
<!-- END something -->
Or:
<!-- BEGIN something -->
<!-- IF SHOWPICTURE -->
<img src="">html code that could be repeated every time
that something.showpictura is true etc
<!-- ENDIF -->
<!-- END something -->
Thanks for the help, but <!-- INCLUDE pronews/pn_art_foot.html false --> doesn't work - that's my point.
Line 54 of includes/classes/template_enc.php preg_match_all('#<!-- INCLUDE ([a-zA-Z0-9\_\-\+\.\/]+?) -->#', $code, $matches);
effectively prevents you passing parameters to INCLUDE.
But then maybe it doesn't matter because on line 118: case 'INCLUDE':
$temp = array_shift($include_blocks);
$compile_blocks[] = '<?php $this->_tpl_include(\''.$temp."'); ?>";
$this->_tpl_include($temp, false);
break;
But I'm suspicious of the 2 calls to _tpl_include, the first without , false, the 2nd with.
Indeed calling this code includes/classes/template.php line 207: // Include a seperate template
function _tpl_include($filename, $include = true)
{
$handle = $filename;
$this->filename[$handle] = $filename;
$this->files[$handle] = $this->root . '/' . $filename;
$filename = $this->_tpl_load($handle);
if ($include) {
if ($filename) {
include_once($filename);
return;
}
eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
}
}
with , false appears to me to effectively be a no-op.
I see that Bug 1122 was closed as 'Bogus' (!?), but the explanation of
LOL. Pies and beers. I look forward to installing it. If after 20 minutes of staring at the screen and thinking about pies, one doesn't turn up - I'll raise a bug report.
Please enter your server specs in your user profile! 😢