tombenner / wp-mvc

An MVC framework for WordPress
http://wpmvc.org
MIT License
624 stars 172 forks source link

Routing not working after upgrade #223

Closed fkh000 closed 6 years ago

fkh000 commented 6 years ago

Hi, after a long time I upgraded one of my projects and seems like the routing stopped working.

My routes.php: $albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::public_connect($album, array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); MvcRouter::public_connect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); }

Example URL: galeria/2018/

I expect these parameters passed to controller: array(4) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" ["album"]=>"galeria" }

But instead I get only this. It is basically right, just missing the 'album' parameter. array(3) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" }

Used to work in older version (not sure which was that). Is there some other way to pass variables from route to controller?

PS. I refreshed the permalinks.

cyberscribe commented 6 years ago

Hi,

controller, action, and id are the only parameters currently accepted. I believe there is also an undocumented "extra" parameter you can use. But there is no "album" parameter that I know about. See: http://wpmvc.org/documentation/routing/

Perhaps you were handling this another way?

On 27 May 2018 at 23:50, fkh000 notifications@github.com wrote:

Hi, after a long time I upgraded one of my projects and seems like the routing stopped working.

My routes.php: $albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::public_connect($album, array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); MvcRouter::public_connect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); }

Example URL: galeria/2018/

I expect these parameters passed to controller: array(4) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" ["album"]=>"galeria" }

But instead I get only this. It is basically right, just missing the 'album' parameter. array(3) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" }

Used to work in older version (not sure which was that). Is there some other way to pass variables from route to controller?

PS. I refreshed the permalinks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV5QI2kJ4E8nhyRgFUQjjtD341lk-Kks5t2y3BgaJpZM4UPdqM .

fkh000 commented 6 years ago

Thanks for answer.

In older versions, the 'album' parameter, which was my own, was passed to controller/action as a parameter when used in the manner I wrote in topic. I am not sure how I found this out, because it is not mentioned enywhere in docs. Probably I just accidentally abused a bug, which has been fixed in newer versions.

I had to fix it by creating separate controller actions. Would be nice to be able to send custom parameters to the controller.

$albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::publicconnect($album, array('controller' => 'galleries', 'action' => 'show' . $album)); MvcRouter::publicconnect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show' . $album)); }

2018-05-30 11:48 GMT+02:00 Robert Peake notifications@github.com:

Hi,

controller, action, and id are the only parameters currently accepted. I believe there is also an undocumented "extra" parameter you can use. But there is no "album" parameter that I know about. See: http://wpmvc.org/documentation/routing/

Perhaps you were handling this another way?

On 27 May 2018 at 23:50, fkh000 notifications@github.com wrote:

Hi, after a long time I upgraded one of my projects and seems like the routing stopped working.

My routes.php: $albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::public_connect($album, array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); MvcRouter::public_connect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); }

Example URL: galeria/2018/

I expect these parameters passed to controller: array(4) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" ["album"]=>"galeria" }

But instead I get only this. It is basically right, just missing the 'album' parameter. array(3) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" }

Used to work in older version (not sure which was that). Is there some other way to pass variables from route to controller?

PS. I refreshed the permalinks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAqV5QI2kJ4E8nhyRgFUQjjtD341lk-Kks5t2y3BgaJpZM4UPdqM .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223#issuecomment-393100302, or mute the thread https://github.com/notifications/unsubscribe-auth/AKYaQicf-NHFzqqC0Ti1ZhdXPcVbzs8Cks5t3mrWgaJpZM4UPdqM .

cyberscribe commented 6 years ago

If you'd like to work on allowing any parameters in the routing pattern in a way that is backwards-compatible, we would welcome a pull request.

On 1 June 2018 at 12:40, fkh000 notifications@github.com wrote:

Thanks for answer.

In older versions, the 'album' parameter, which was my own, was passed to controller/action as a parameter when used in the manner I wrote in topic. I am not sure how I found this out, because it is not mentioned enywhere in docs. Probably I just accidentally abused a bug, which has been fixed in newer versions.

I had to fix it by creating separate controller actions. Would be nice to be able to send custom parameters to the controller.

$albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::publicconnect($album, array('controller' => 'galleries', 'action' => 'show' . $album)); MvcRouter::publicconnect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show' . $album)); }

2018-05-30 11:48 GMT+02:00 Robert Peake notifications@github.com:

Hi,

controller, action, and id are the only parameters currently accepted. I believe there is also an undocumented "extra" parameter you can use. But there is no "album" parameter that I know about. See: http://wpmvc.org/documentation/routing/

Perhaps you were handling this another way?

On 27 May 2018 at 23:50, fkh000 notifications@github.com wrote:

Hi, after a long time I upgraded one of my projects and seems like the routing stopped working.

My routes.php: $albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::public_connect($album, array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); MvcRouter::public_connect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); }

Example URL: galeria/2018/

I expect these parameters passed to controller: array(4) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" ["album"]=>"galeria" }

But instead I get only this. It is basically right, just missing the 'album' parameter. array(3) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" }

Used to work in older version (not sure which was that). Is there some other way to pass variables from route to controller?

PS. I refreshed the permalinks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAqV5QI2kJ4E8nhyRgFUQjjtD341lk-Kks5t2y3BgaJpZM4UPdqM .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223#issuecomment-393100302, or mute the thread https://github.com/notifications/unsubscribe-auth/AKYaQicf- NHFzqqC0Ti1ZhdXPcVbzs8Cks5t3mrWgaJpZM4UPdqM .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223#issuecomment-393855316, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV5cRApkULVSY_VcUGh15QuXVnmF4bks5t4SgVgaJpZM4UPdqM .

fkh000 commented 6 years ago

Srry, too much work for me, done it the proper way now and hopefully i am done with it for couple more years :)

2018-06-04 10:08 GMT+02:00 Robert Peake notifications@github.com:

If you'd like to work on allowing any parameters in the routing pattern in a way that is backwards-compatible, we would welcome a pull request.

On 1 June 2018 at 12:40, fkh000 notifications@github.com wrote:

Thanks for answer.

In older versions, the 'album' parameter, which was my own, was passed to controller/action as a parameter when used in the manner I wrote in topic. I am not sure how I found this out, because it is not mentioned enywhere in docs. Probably I just accidentally abused a bug, which has been fixed in newer versions.

I had to fix it by creating separate controller actions. Would be nice to be able to send custom parameters to the controller.

$albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::publicconnect($album, array('controller' => 'galleries', 'action' => 'show' . $album)); MvcRouter::publicconnect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show' . $album)); }

2018-05-30 11:48 GMT+02:00 Robert Peake notifications@github.com:

Hi,

controller, action, and id are the only parameters currently accepted. I believe there is also an undocumented "extra" parameter you can use. But there is no "album" parameter that I know about. See: http://wpmvc.org/documentation/routing/

Perhaps you were handling this another way?

On 27 May 2018 at 23:50, fkh000 notifications@github.com wrote:

Hi, after a long time I upgraded one of my projects and seems like the routing stopped working.

My routes.php: $albums = array('galeria', 'vystavy');

foreach($albums as $album) { MvcRouter::public_connect($album, array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); MvcRouter::public_connect($album . '/{:id}', array('controller' => 'galleries', 'action' => 'show', 'album' => $album)); }

Example URL: galeria/2018/

I expect these parameters passed to controller: array(4) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" ["album"]=>"galeria" }

But instead I get only this. It is basically right, just missing the 'album' parameter. array(3) { ["controller"]=> string(9) "galleries" ["action"]=> string(4) "show" ["id"]=> string(4) "2018" }

Used to work in older version (not sure which was that). Is there some other way to pass variables from route to controller?

PS. I refreshed the permalinks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAqV5QI2kJ4E8nhyRgFUQjjtD341lk-Kks5t2y3BgaJpZM4UPdqM .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/tombenner/wp-mvc/issues/223#issuecomment-393100302 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKYaQicf- NHFzqqC0Ti1ZhdXPcVbzs8Cks5t3mrWgaJpZM4UPdqM .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223#issuecomment-393855316, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV5cRApkULVSY_ VcUGh15QuXVnmF4bks5t4SgVgaJpZM4UPdqM

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/223#issuecomment-394269587, or mute the thread https://github.com/notifications/unsubscribe-auth/AKYaQschgGOMEfpmsxrrn7UE9GJcpM7Aks5t5OsPgaJpZM4UPdqM .