Block plugins caching error

3 views
Skip to first unread message

allmarkedup

unread,
Jun 18, 2009, 11:51:39 AM6/18/09
to Smarty Developers
Hi,

I am having an issue with caching when using block plugins.

If there is a block plugin used on the page then I get an error
similar to the following:

Parse error: syntax error, unexpected '}' in /Volumes/vgroup_one/
VGROUP/140_1_VGROUP_CMS/vgroup_website_CMS/application/cache/
templates_c/1304090797.footer.php.cache.php on line 38

It looks like the closing 'section' of the block plugin in the cached
template is not getting 'echo'ed like the opening section - but this
only seems to be happening when caching is enabled.

The relevant section of the cached compiled template looks like this:

-------------------

<?php echo '<?php $_block_repeat=true;$_smarty_tpl->smarty-
>plugin_handler->loadSmartyPlugin(\'entries\', \'block\');
$_smarty_tpl->smarty->registered_plugins[\'entries\'][1](array(\'limit
\'=>3,\'module\'=>\'projects\'), null, $_smarty_tpl->smarty,
$_block_repeat, $_smarty_tpl);while ($_block_repeat) { ob_start();?>';?
>

<p>tesing block plugin</p>

<?php $_block_content = ob_get_contents(); ob_end_clean();
$_block_repeat=false; echo $_smarty_tpl->smarty->registered_plugins
['entries'][1](array('limit'=>3,'module'=>'projects'),
$_block_content, $_smarty_tpl->smarty, $_block_repeat,
$_smarty_tpl); }?>

-------------------

It seems that the section that starts with $_block_content =
ob_get_contents(); should be echoed as per the top section?

Please let me know if you need any more info, I hope the details above
make sense!

Many thanks, Mark

U.Tews

unread,
Jun 18, 2009, 2:08:48 PM6/18/09
to Smarty Developers
Hi Mark

Thanks for your input. This problem is fixed nw in the SVN.

Regards Uwe

ma...@allmarkedup.com

unread,
Jun 18, 2009, 2:51:05 PM6/18/09
to smarty-d...@googlegroups.com
Hi Uwe,

Thanks for the quick fix - I will get a chance to test it out tomorrow
so I'll let you know if I have any further problems.

Kind regards,

Mark

allmarkedup

unread,
Jun 19, 2009, 9:55:37 AM6/19/09
to Smarty Developers
Hi again Uwe,

So that has sorted out the PHP error it was throwing, but now when
caching is enabled, if I assign an object to the template from within
the block function then I cannot access it's properties?

I.e.

{entries}

{$test} // value assigned within the block function, prints out
correctly
{$myObj->test} // object assigned within the block function, no value
printed out here

{/entries}

Again this is only a problem when caching is enabled, although if I
wrap the {block}{/block} in a {nocache} block then it *does* work
correctly.

Many thanks,

Mark

U.Tews

unread,
Jun 19, 2009, 11:05:19 AM6/19/09
to Smarty Developers
Mark

I could not reproduce the problem here. I do get output from a object
property here.

Do you load the block plugins from file or did you use the
register_block methode?

Could you email the complete code for debugging to me?

Regards Uwe
Reply all
Reply to author
Forward
0 new messages