Skip to content

Commit

Permalink
Twig url_for fix
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Hoffman <[email protected]>
  • Loading branch information
Fustrate committed Aug 18, 2012
1 parent 5df1dd8 commit ad2e78a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions library/smCore/Twig/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,15 @@ public static function function_url_for($endpoint, array $query_arguments = arra
{
if (!empty($endpoint))
{
$url = self::$_container['settings']['url'] . '/' . trim($endpoint, '/') . '/';
$url = '/' . trim($endpoint, '/') . '/';
}
else
{
$url = self::$_container['settings']['url'] . '/';
$url = '/';
}

$query = '';

if (!empty($query_arguments))
{
$arguments = array();
Expand All @@ -193,10 +195,10 @@ public static function function_url_for($endpoint, array $query_arguments = arra
}
}

return $url . '?' . implode(';', $arguments);
$query = '?' . implode(';', $arguments);
}

return $url;
return self::$_container['settings']['url'] . str_replace('//', '/', $url) . $query;
}

/**
Expand Down

0 comments on commit ad2e78a

Please sign in to comment.