|
=== highlight ===
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] <code> <?php /* * 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); }?> </code> Example from a string assigned to Smarty: <code> {$php_code|highlight} </code> Another example inside a template: <code> <pre> {capture assign=code}{literal} <?php # Example of PHP code to highlight echo 'Hello'; ?> {/literal}{/capture}{$code|highlight} </pre> </code> Back to SmartyPlugins. |