|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
lsces Smarty Rookie
Joined: 03 Dec 2011 Posts: 8
|
Posted: Sun Feb 07, 2016 1:41 pm Post subject: Object scope in block |
|
|
Another probably PHP related problem. Having got everything moved over to PHP7, updated all the third party stuff, and even updated all the SmartyBC stuff to eliminate the residual Smarty2 code I had almost everything working ... except ...
http://php7.lsces.org.uk/ is the test etup, and is displaying content in the right hand modules, but when I first got things running they were blank.
The hacked code below is working, but the problem eems to be with the 'scope' of $gBitSmarty which is what should be supplied in &$gBitX but 'modInfo' while being displayed in the getTemplateVars on both scopes, only doing the assign to the global version results in the fetch being populated.
function smarty_block_bitmodule( $pParams, $pContent, &$gBitX) {
global $gBitSmarty;
if( empty( $pContent )) {
return '';
} else {
$pParams['data'] = $pContent;
}
$pParams['name'] = preg_replace( "/[^a-zA-Z0-9\\-\\_]/", "", $pParams['name'] );
$gBitSmarty->assign( 'modInfo', $pParams );
// vd( $gBitSmarty->getTemplateVars() );
// vd($gBitX->getTemplateVars());
$module = $gBitX->fetch('bitpackage:themes/module.tpl');
// vd($module);
return $module;
}
Anybody got any idea where to look next? OTHER bocks are working fine, but are probably using display rather than fetch, so I suspect the problem is there somewhere. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|