Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iturgeon/fuel-filter

FuelPhP Filtered View Module Extension
https://github.com/iturgeon/fuel-filter

Last synced: about 2 months ago
JSON representation

FuelPhP Filtered View Module Extension

Awesome Lists containing this project

README

        

Fuel Filter Views
===================

This little add-on lets you create new FuelPHP View Filters that process the strings generated by a rendered View.

No Follow Filter
====================

Included in the code is a sample No Follow Filter. This filter injects rel="nofollow" into html links.

Usage:

```php
// create a new view (these extend FuelPHP's View Class)
$view = \Filter\View::forge('myView');
$view->add_filters(\Filter\NoFollow::forge());
echo($view);
```

Creating Custom Filters
========================

Create a new Filter class that extends our Filter class.

For example: this class named /fuel/app/classes/reversefilter.php

```php

namespace \Filter;

class ReverseFilter extends Filter
{
public static function process($string)
{
return strrev($string);
}
}
```

Usage:

```php
// create a new view (these extend FuelPHP's View Class)
$view = \Filter\View::forge('myView');
$view->add_filters(ReverseFilter::forge());
echo($view);
```

Installation
================

The easiest way to install in Fuel is to use composer.

1. Add `"iturgeon/fuelfilter" : "1.0.*"` to your require section in composer.json
2. Run `php composer.phar update`

Sample Section of composer.json:

```
"require": {
...
"iturgeon/fuelfilter" : "1.0.*"
}
```