Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Good design preview mode in IDEs for Smarty tags (no noise)

 
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 420
Location: Kathmandu, Nepal

PostPosted: Wed Mar 14, 2012 9:53 am    Post subject: Good design preview mode in IDEs for Smarty tags (no noise) Reply with quote

Some of the smarty template tags like {if}, {foreach}, ... will noise in the IDE's design preview mode.

Just wrap such tags with html commenting <!-- and -->.
And they will vanish. It will add a minor extra output (blank html comments), but is ok than to noise the design preview mode.

You can remove those comment wrappers at production level or just leave them there.

For example look at the the two codes.
Old noisy code:
Code:
<h1>Block 3</h1>
<div class="details">
{section name='b3' loop=$block3}
<div class="holder">
   <div class="title">Choice {$block3[b3].priority_id}</div>
   <div class="content">
      <p>{$block3[b3].course}</p>
   </div>
   </div>
{sectionelse}
   <p>No courses chosen in this block.</p>
{/section}
</div>


And the clean code for design preview mode is:
Code:
<h1>Block 3</h1>
<div class="details">
<!--{section name='b3' loop=$block3}-->
<div class="holder">
   <div class="title">Choice {$block3[b3].priority_id}</div>
   <div class="content">
      <p>{$block3[b3].course}</p>
   </div>
   </div>
<!--{sectionelse}-->
   <p>No courses chosen in this block.</p>
<!--{/section}-->
</div>


Interesting?
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks 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