6godfather929265
6godfather929265

Router default value is ($defaultValue = 'default';), and I want to be empty string, is this possible? This problematic default value is when using rainlab/translate plugin, and have default route with /:anyPoperty? (:anyProperty? one or none value). When language change it's redirect to page with default in url (exp. www.mywebsite.com/en/default). Same problem happens when you using pageUrl method from controller (exp. $this->controller->pageUrl(...))

Last updated

daftspunk
daftspunk

If your URL contains a ? then it will be optional. The only time "default" is used is when the router has no choice

For example

url = "/:foo?/:bar"

The "foo" cannot be optional because "bar" is mandatory

Can you provide the theme template and code that is causing the "anyProperty" to show a "default" value when resolving?

tom9466
tom9466

daftspunk said:

If your URL contains a ? then it will be optional. The only time "default" is used is when the router has no choice

For example

url = "/:foo?/:bar"

The "foo" cannot be optional because "bar" is mandatory

Can you provide the theme template and code that is causing the "anyProperty" to show a "default" value when resolving?

What if we'd like that part to be totally optional?

i.e. the same content would be accessible via:

  • /member/blog/that-post
  • /blog/that-post

or is there a way to set multiple routes for a "page"?

When doing something like /:area?/blog/post/:slug, :area cannot be totally optional as it will fill that part of the URI with "default"

It's funny I find this recent thread, I was going to start one with the same question. Thanks!

tom9466
tom9466

Anyone? Thanks

Last updated

1-4 of 4