1
0
mirror of https://github.com/dannyvankooten/AltoRouter.git synced 2025-08-05 16:07:32 +02:00

Fixed generate() replacing leaving [s, made empty optional parameters blank

This commit is contained in:
dansmith
2012-08-16 11:56:13 +01:00
parent 4d8dedb9f5
commit 2125019ed3

View File

@@ -65,8 +65,14 @@ class AltoRouter {
foreach($matches as $match) {
list($block, $pre, $type, $param, $optional) = $match;
if ($pre) {
$block = substr($block, 1);
}
if(isset($params[$param])) {
$url = str_replace(substr($block,1), $params[$param], $url);
$url = str_replace($block, $params[$param], $url);
} elseif ($optional) {
$url = str_replace($block, '', $url);
}
}