You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 22, 2024. It is now read-only.
// injects parameters into the urlif (preg_match_all('/(:([a-z0-9_]+))/i', $action, $matches)) {
for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
if (array_key_exists($matches[2][$i], $params)) {
$action = str_replace($matches[1][$i], $params[$matches[2][$i]], $action);
unset($params[$matches[2][$i]]);
} elseif (array_key_exists($matches[2][$i], $default)) {
// default value is found, remove he related part from url$action = preg_replace('/:'.$matches[2][$i].'\/?/i', '', $action);
}
}
}
Currently, it remove /:year from the url, but the action file doesn't receive any year default value.
As possible side-effects, we must think about people using Atomik without url-rewriting.
The text was updated successfully, but these errors were encountered:
This is a very interesting topic: i was forced to specify the default values of the parameters every time i created a url.
I hope Maxime can help us to find a solution in the short.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm trying to bind those url to the same route :
posts
posts/2014
I used default values for my
:year
parameter, as defined in documentation :Here are the results :
Atomik::url('@posts', array('year'=>2014))
domain.tld/posts/2014
Atomik::url('@posts')
domain.tld/posts/:year
How could we remove this unused/unusable
/:year
from the url ?We should :
Atomik::url('@posts')
without parameterdomain.tld/posts
as the rewritten urlyear
parameter set toall
in our action fileI made an attempt to get it work (see this fork) :
Currently, it remove
/:year
from the url, but the action file doesn't receive anyyear
default value.As possible side-effects, we must think about people using Atomik without url-rewriting.
The text was updated successfully, but these errors were encountered: