|
You are here: Home / Documentation / Template Modes |
Template ModesContent FiltersHere is a simple content filter example function. You can try this out by saving it to a file named inc/app/myapp/lib/Example.php. <?php
/**
* This is an example filter that inserts a trademark symbol next to
* any occurrence of the name "Sitellite".
*
* @access public
* @param string
* @return string
* @package Myapp
*/
function myapp_example_content_filter ($body) {
return str_replace (
'Sitellite',
'Sitellite<sup>TM</sup>',
$body
);
}
?>
To activate this filter for the body field, add the following line under the [html] block of your modes.php file: filter 3 = "body: myapp.Example" Now, wherever the name "Sitellite" appears, you should see a trademark symbol. Note that this example was simplified and doesn't consider whether the "Sitellite" name appears inside an HTML tag attribute. For an example that is HTML-aware, take a look at the lib/Terms.php file in the SiteGlossary app. Page 1: File Format |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |