Smarty

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
Thijs

Smarty

Post by Thijs »

Since CMS generated pages are based on Smarty, you have access to a lot of powerful features that smarty offers.

Let us look at the mailto custom function. The following code

Code: Select all

{mailto address="me@domain.com"}
{mailto address="me@domain.com" text="send me some mail"}
{mailto address="me@domain.com" encode="javascript"}
{mailto address="me@domain.com" encode="hex"}
{mailto address="me@domain.com" subject="Hello to you!"}
{mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
{mailto address="me@domain.com" extra='class="email"'}
is translated to:

Code: Select all

<a href="mailto:me@domain.com" >me@domain.com</a>
<a href="mailto:me@domain.com" >send me some mail</a>
<__script__ type="text/javascript" language="javascript">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%6
9%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%
61%69%6e%2e%63%6f%6d%22%20%3e%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%3c%2f%61%3e
%27%29%3b'))</__script>
<a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d" >me@domain.com</a>
<a href="mailto:me@domain.com?subject=Hello%20to%20you%21" >me@domain.com</a>
<a href="mailto:me@domain.com?cc=you@domain.com%2Cthey@domain.com" >me@domain.com</a>
<a href="mailto:me@domain.com" class="email">me@domain.com</a>
Easy as that. Especially the javascript based encoding is an effective anti-spam measure.
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

Re: Smarty

Post by kishman155 »

Thanks for this i will play with it a while

mfg
Kris
User avatar
uhuy.net
New Member
New Member
Posts: 7
Joined: Sat Nov 08, 2008 9:39 pm

Re: Smarty

Post by uhuy.net »

thanks,
i just looking for this
Post Reply

Return to “Tips and Tricks”