|
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 |
edelacruz Smarty Rookie
Joined: 10 May 2010 Posts: 25
|
Posted: Thu May 15, 2014 8:12 pm Post subject: Cannot show literal {block} string |
|
|
I am trying to literally show a string like:
{block "FooBlock"}{/block}
But I cannot. Smarty always does some sort of parsing to the {block}'s.
My Code:
Code: | {literal}<body>
<div>
<h1>Foos</h1>
{block "FooBlock"}{/block}
</div>
<div>
<h1>Bars</h1>
{block "BarBlock"}{/block}
</div>
</body>
{/literal} |
Expected Result:
Code: | <body>
<div>
<h1>Foos</h1>
{block "FooBlock"}{/block}
</div>
<div>
<h1>Bars</h1>
{block "BarBlock"}{/block}
</div>
</body> |
Actual Result:
Code: | <body>
<div>
<h1>Foos</h1>
{private_child_block name="FooBlock" file='C:\xampp\vhosts\somesite.com\SomeSite\Presentation\Templates\Ui\Views.tpl' uid='0fcb4ab448b5c5c8390092d6b63e3197d080f42a' line=246}{/private_child_block}
</div>
<div>
<h1>Bars</h1>
{private_child_block name="BarBlock" file='C:\xampp\vhosts\somesite.com\SomeSite\Presentation\Templates\Ui\Views.tpl' uid='0fcb4ab448b5c5c8390092d6b63e3197d080f42a' line=250}{/private_child_block}
</div>
<body> |
Instead of showing the {block}'s literally, Smarty is rendering {private_child_block}'s in their place.
Am I doing something wrong or is this a bug?
Thanks in advance.
I've been using Smarty for years and wouldn't go without it. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri May 16, 2014 4:03 pm Post subject: |
|
|
This is indeed a bug.
Template inheritance ins Smarty 3.1 is a compile time process where the content from child and parent templates is merged together.
For that Smarty sets markers in the source during processing and by mistake does not observe the {literal} tags.
I will try to fix it during the next couple of days.
For the time being you can use { and } for the curle braces. |
|
Back to top |
|
edelacruz Smarty Rookie
Joined: 10 May 2010 Posts: 25
|
Posted: Fri May 16, 2014 8:43 pm Post subject: |
|
|
This is not a live site yet so I have no problem waiting a few days for the fix. In the meantime, the workaround you provided is perfectly adequate.
Your response time is impressive. Thanks for the great support. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Jun 08, 2014 4:08 pm Post subject: |
|
|
The bugfix is now in the SVN trunk and will later be included in 3.1.19 |
|
Back to top |
|
edelacruz Smarty Rookie
Joined: 10 May 2010 Posts: 25
|
Posted: Thu Jun 12, 2014 8:18 am Post subject: |
|
|
U.Tews wrote: | The bugfix is now in the SVN trunk and will later be included in 3.1.19 |
Thank you. |
|
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
|