Modifier that highlight a string of PHP code.

This modifier is useful when you want to display some example of PHP code.

It is possible to download this modifier from [here].

Author: [Davide 'Design' Muzzarelli]

 * Smarty plugin
 * -------------------------------------------------------------
 * File:     modifier.highlight.php
 * Type:     modifier
 * Name:     highlight
 * Purpose:  highlight a string of PHP code
 * @link http://www.dav-muz.net/
 * @version 1.0
 * @copyright Copyright 2011 by Davide Muzzarelli
 * @author Davide Muzzarelli <d.muzzarelli@dav-muz.net>
 * @license New BSD
 * @param string containing var-attribute
 * @return string highlighted HTML text inside a "code" tag
 * -------------------------------------------------------------
function smarty_modifier_highlight($string)
    return highlight_string($string, true);

Example from a string assigned to Smarty:


Another example inside a template:

{capture assign=code}{literal}
  # Example of PHP code to highlight
  echo 'Hello';

Back to SmartyPlugins?.