public function parseTemplateText($viewText, &$model) {

        // Extract all template parameters into scope.
        extract($model);

        // Store defined variables before we evaluate
        $preVariables = get_defined_vars() ? get_defined_vars() : array();
        unset($preVariables["model"]);

        // Now use an object buffer to get the result.
        ob_start();
        include $viewText;
        $result = ob_get_contents();
        ob_end_clean();

        // Add any newly scoped variables
        $postVariables = get_defined_vars() ? get_defined_vars() : array();
        foreach ($postVariables as $key => $value) {
            if ($key == "model") continue;
            if (!isset($preVariables[$key]) || ($value != $preVariables[$key])) {
                $model[$key] = $value;
            }
        }


        return $result;
    }