Added UrlGenerator smarty plugin, to allow templates and url

manipulation in templates.
This commit is contained in:
franck
2013-07-17 11:36:28 +02:00
parent 0dfee8331b
commit 21068f4c1f
4 changed files with 79 additions and 7 deletions

View File

@@ -32,7 +32,6 @@ class URL
*
* @param string $path the relative path
* @param mixed $parameters An array of parameters
* @param Boolean|string $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
*
* @return string The generated URL
*/
@@ -54,4 +53,18 @@ class URL
return $base . $queryString;
}
/**
* Returns the Absolute URL to a view
*
* @param string $viewName the view name (e.g. login for login.html)
* @param mixed $parameters An array of parameters
*
* @return string The generated URL
*/
public static function viewUrl($viewName, array $parameters = array()) {
$path = sprintf("%s?view=%s", ConfigQuery::read('base_url', '/'), $viewName);
return self::absoluteUrl($path, $parameters);
}
}