About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / Documentation / Template Modes

Template Modes

Content Filters

Here 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
Page 2: Content Filters
Page 3: Creating an Alternate Output Mode: DocBook
Page 4: Another Quick Output Mode: PDF

All Tutorials

Members

Note: You can use your SitelliteForge.com account here and vice versa.

Username

Password

Forgot your password?

Not a member? Click here to register

Sitellite 5 Beta


Copyright © 2008, SIMIAN systems Inc.
All rights reserved. Privacy policy
Some of the icons on this site were created by the Gnome Project.