|
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 |
torkve Smarty n00b
Joined: 01 May 2012 Posts: 2
|
Posted: Tue May 01, 2012 9:09 pm Post subject: Fail if custom {block} uses custom block |
|
|
The way to reproduce:
1. Create some user block in smarty/plugins/block.t.php:
Code: | <?php
function smarty_block_t($params, $text, $template, $repeat)
{
return $text;
} |
2. index.php:
Code: | <?php
define('SMARTY_DIR', dirname(realpath(__FILE__)).'/smarty/');
require_once('smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir('./templates');
$smarty->setCompileDir('./cache/templates_c');
$smarty->setCacheDir('./cache/smarty');
$smarty->setCaching(smarty::CACHING_OFF);
$smarty->assign('page', 'kekeke');
$smarty->display('index.tpl'); |
3. templates/index.tpl
Code: | {extends file="base.tpl"}
{block name=title}{t}aaa{/t}{/block} |
4. templates/base.tpl
Code: | {nocache}{block name=title}{$page}{/block}{/nocache} |
During the execution first time I get:
Code: | /*%%SmartyNocache:3667015794fa05080616d78-86782824%%*/smarty; if (!is_callable('smarty_block_t')) include '.../testcase/smarty/plugins/block.t.php'; ?>/*/%%SmartyNocache:3667015794fa05080616d78-86782824%%*/aaa |
Next times the output is:
Code: | /*%%SmartyNocache:3667015794fa05080616d78-86782824%%*/smarty; if (!is_callable('smarty_block_t')) include '.../testcase/smarty/plugins/block.t.php'; ?>/*/%%SmartyNocache:3667015794fa05080616d78-86782824%%*/ Fatal error: Call to undefined function smarty_block_t() in '.../testcase/cache/templates_c/c0360d049dff10f364dfc53ba2cc3958abf6ee6d.file.index.tpl.php on line 34 |
|
|
Back to top |
|
torkve Smarty n00b
Joined: 01 May 2012 Posts: 2
|
Posted: Wed May 02, 2012 9:44 am Post subject: |
|
|
Forgot to mention, reproduced on Smarty 3.1.8, and svn trunk versions. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed May 02, 2012 3:02 pm Post subject: |
|
|
The problem is the usage of {nocache} tags around {block} tags, when caching is disabled (smarty::CACHING_OFF).
I will try to fix this ASAP |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed May 02, 2012 5:20 pm Post subject: |
|
|
This bug is now fixed in the SVN trunk and will later be included in 3.1.9 |
|
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
|