ppi/framework — Issue #11: View Helpers
Author: dragoonis
Created: 2011-12-19 21:26:00+00:00
State: open

I guess this could be more of a 'Skeleton App' discussion since it's not really functionality native to the framework, but just some glue between them.

# The Goal

To load view helper classes easily as part of your rendering process in your controller.

# Current Implementation
Really you just load a class and pass it on.. which is kinda manual labour.

``` php
render('user/login', compact('form'));
```

# Ideal Implementation

Maybe somewhere on your controller, such as preDispatch() you can register all view helpers that your controller uses by default. This could cut down code re-use but it's still manually maintained so theres no "load all helpers in this $dir" approach which would result in unnecessary helper loads.

``` php
addViewHelper('formHelper', new \PPI\Form());
}

function index() {
$this->render('user/index');
}

function login() {
$this->render('user/login');
}

}
```

And then in your view you can just access it like:

``` php

text('username'); ?>

```