Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Cannot show literal {block} string

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
edelacruz
Smarty Rookie


Joined: 10 May 2010
Posts: 25

PostPosted: Thu May 15, 2014 8:12 pm    Post subject: Cannot show literal {block} string Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5067
Location: Hamburg / Germany

PostPosted: Fri May 16, 2014 4:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
edelacruz
Smarty Rookie


Joined: 10 May 2010
Posts: 25

PostPosted: Fri May 16, 2014 8:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5067
Location: Hamburg / Germany

PostPosted: Sun Jun 08, 2014 4:08 pm    Post subject: Reply with quote

The bugfix is now in the SVN trunk and will later be included in 3.1.19
Back to top
View user's profile Send private message
edelacruz
Smarty Rookie


Joined: 10 May 2010
Posts: 25

PostPosted: Thu Jun 12, 2014 8:18 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP