Skip to content
This repository has been archived by the owner on Nov 27, 2017. It is now read-only.

Creating filters

blazeeboy edited this page Apr 7, 2011 · 1 revision

filters are a post processor for contents output, content output is passed to filter and it make some changes, addition, modefications the n produce the final output

filters could be nested, like photoshop filter, you can apply a filter1, filter2, filter3, every filter will get the previous filter output and process it the output another text.

you can use filters to remove bad words, add borders, remove HTML tags, generate gallery from UL, or even replace strings, the possibilities are unlimited.

where to put filters ?

filters reside in application/views/filter it is a codeigniter php view file (normal php file).

Variables

every filter file when loaded Egypt will pass 2 variables

  1. text : that is the content output, you can process the echo() the final output
  2. id : the current content id in case you want to get the content and make process or grab information from it

Example

this is a filter that will remove HTML tags from any content output producing a plain text

<?= strip_tags( $text ); ?> 

Another example

that filter will create dojo title pane around the content

<?php
$ci =& get_instance();
$ci->load->library( 'gui' );

$cont = new Content();
$cont->get_by_id($id);

echo $ci->gui->titlepane( $cont->title, $text);
?>

filters are fun, have a look at photoshop image filter, GIMP filters, and you get the idea and inspiration you need.
Clone this wiki locally