phproutesfat-free-framework

Different routes on FatFreeFramework


I have next route with a custom variable:

[routes]
GET /category/@item.html = \Controllers\Category\Item->show

It works as expected and I can visit next pages:

I also have next pages (where XYZ is a known constant vlue):

Is it possible to create separate route rule for such pages? I.e. I want to use different controllers for item1.html and item1XYZ.html.

I was wondering that routes sections can be modified like this:

[routes]
GET /category/@item.html        = \Controllers\Category\Item->show
GET /category/{{@item}}XYZ.html = \Controllers\Category\ItemXYZ->show

But looks like no.


Solution

  • Single curly braces are enough:

    [routes]
    GET /category/@item.html        = \Controllers\Category\Item->show
    GET /category/{@item}XYZ.html   = \Controllers\Category\ItemXYZ->show