/**
 * Render a view template partial.
 * @param string $name to load without the prefix
 */
function renderPartial($name)
{
    assert('!empty($name); // provide a name for the partial');
    // are we using a custom partial or default?
    if (strpos($name, '/') !== FALSE) {
        $partial = BASEPATH . '/' . APP_DIR . '/views/' . ucfirst(current($name = explode('/', $name))) . '/_' . end($name) . '.phtml';
    } else {
        // build up a path using underscore prefix for a partial
        $partial = BASEPATH . '/' . APP_DIR . '/views/' . Fari_ApplicationViewHelper::getPresenter() . '/_' . $name . '.phtml';
    }
    // is it valid?
    try {
        // check if file path exists
        if (!file_exists($partial)) {
            throw new Fari_Exception('Partial could not be located in: ' . $partial);
        }
    } catch (Fari_Exception $exception) {
        $exception->fire();
    }
    // extract values so we have access to them
    extract(Fari_ApplicationViewHelper::getValues(), EXTR_SKIP);
    // include it finaly with comments around, but only in development mode
    $devMode = Fari_ApplicationEnvironment::isDevelopment();
    if ($devMode) {
        echo "\n<!-- begin {$partial} -->\n";
    }
    include $partial;
    if ($devMode) {
        echo "\n<!-- end {$partial} -->\n";
    }
}