Re: [SMARTY-DEV] Patch : ghost delimiting
| From: | Monte Ohrt | Date: | Wed, 05 Jun 2002 13:34:18 +0000 |
| Subject: | Re: [SMARTY-DEV] Patch : ghost delimiting | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-114@lists.php.net to get a copy of this message | ||
Use a prefilter that converts "<!--{" to "{" and "}-->" to "}". Then you can use either syntax in your templates.
olivier guilyardi wrote:
Hi
I am currently developing a php based intranet for a company, using Smarty.
We are 2 on this project : me the coder, and a graphist. And trust me, i am
not a graphist, and she is not a coder ;)
When I discovered Smarty at early stages of this project, I immediatly
noticed how the documentation is clearly separating the roles of designer
and coder. This is what we needed.
But, now in implementation stage, there is a real problem :
What we want are templates which are fully viewable in a browser, so that
she can immediatly see how her images render, and how the design suit them.
Meanwhile these templates must be exploitable without any change by the
application to generate dynamic pages.
And a part of the view logic is handled in the templates with {if}
statements, which helps much the whole development. But this results in
(very) messed up templates, that is : unviewable.
So i made a few changes to Smarty 2.1.1, which allow to do this :
<td align="center" class="blue">
<!--{if $ActiveColor eq "blue" }-->
Blue
<!--{else}
<a href="{$BlueAction}" class="grey">
Blue
</a>
{/if}-->
</td>
In this example, a left delimiter can be { or <!--{ and a right delimiter
can be } or }-->. The templates just get crunchy to browse at :)
To enable or disable this behaviour, I added the "var $ghost_delimiting"
boolean option.
Here is the patch + a demo :
http://dre18.mine.nu/patchfabrik/Smarty-2.1.1-ghost_delim
Tell me what you think about it.
--og
--
Monte Ohrt <monte@ispi.net>
Director of Technology, ispi Inc.