Learn PHP
PHP techniques
PHP Smarty Functions
PHP Web Email
Secure development
PHP Security Scenario
PHP Smarty
PHP Smarty Modifiers
PHP Smarty Caching
PHP Smarty Misc
Zend Framework
PHP basics

PHP Smarty Miscellaneous


Smarty comes with its own debugging console (see the image at right). To invoke the debugging console, set the $debugging variable to TRUE in your PHP code:
$page = new Smarty(); 
$page->debugging = TRUE;
The console pops up in a separate window (see the figure), showing the templates being used, the values of variables, and other useful information.


Basic mathematical calculations can be done within Smarty templates:
Price: ${$price} 
Qty: {$qty} 
Total: ${$qty * $price}


Smarty supports adding features through the creation of plugins. By writing your own plugin, you can make a new modifier or function. The details for creating your own plugin are discussed in the Smarty manual.
an obsfucated email address

Obfuscating E-mail Addresses

The {mailto} plugin can be used to safeguard e-mail addresses. E-mail addresses can be harvested by spambots that read a page's HTML source and pull out anything that looks like an e-mail address. This plugin uses JavaScript to mask the address in the HTML source, while preserving it's appearance in the browser (see the image at right). Although spambots could theoretically still retrieve the e-mail address, this is safer than using no obfuscation at all.
{mailto address=$email encode='javascript' subject='Default Subject Line'}

Smarty Template Functions

In this tutorial you learned about how to use various PHP smarty template functions including email obfuscation, mathematical operators, debugging console, configuration, and more.

Article continues:  <<previous page

 Download NuSphere PHP IDE

Download a free trial of the fast PHP EDitor and robust Integrated Development Environment for PHP.

 Buy NuSphere PhpED® now

Best PHP Editor and complete PHP IDE.
NuSphere PhpED 19.0 is available from our online store front.

 Special Team4 Offer

Get 4 copies of PhpED for the price of 3!

Optimum solution for development teams.
PhpED 19.0 Team4
Need more than 4 licenses? Contact Us for more quantity discounts, please use "Ordering/Payment issue" subject on the form.
"To be honest its bloody awesome, I have looked at loads of PHP editors and this is THE only one that actual works straight out of the box!!! Brilliant, well done."
Andrew Breward,
Director of Technology