I want my templates to be neat and beautiful, but I would like to deliver only a very compact HTML file to the browser. Lacking a better idea, I was wondering if something was wrong with wrapping all Smarty templates in tags {strip}like this?
{strip}
<div class="albums">
<h2>Alle Foto-Alben</h2>
<ul class="photos clearfix">
{foreach $albums as $album}
{if $album->publishedPhotos|count > 0}
<li>
<div>
<a href="album.php?id={$album->id}">
<img src="{$album->titlepic->thumb}" alt="{$album->titlepic->title}" />
<span class="title">{$album->title}</span>
<span class="counter">{$album->publishedPhotos|count} Foto{if $album->publishedPhotos|count != 1}s{/if}</span>
</a>
</div>
</li>
{/if}
{/foreach}
</ul>
</div>
{/strip}
It smells a bit unprofessional for me, but I couldn't think of anything better.
One drawback definitely is that you have to wrap each of your templates in those tags.
I am glad that it has been fixed and would like to hear different approaches to maintaining compact code.
source
share