- Member | 14
I am beginner at Nette and I need help with routing.
I need this:
/home PagePresenter:default (parameter home)
/home/upravit PagePresenter:edit (parameter home)
/function PagePresenter:default (parameter funkce)
/news PostPresenter:default (parameter novinky)
/news/add PostPresenter:add (parameter novinky)
/news/delete/1 PostPresenter:deleter (parameters novinky,1)
/homeworks PostPresenter:default (ukoly)
This was only a fraction of all possible URLs.
I have two ideas:
- Create a special event for every presenter except PagePresenter, which contains only text.
- Save presenter and action into database.
It's not about the code, but rather would be interested in your opinion of the way to do it.
In the first option is, in my opinion, the problem that the project will
include a lot of classes, which will be a lot of code repeated. But on the other
hand, the project will probably be clearer (not need code to be divided into
branches according to parameter).
In the second possibility I do not know how it should look about database scheme and programming route would be little more complicated.
- Member | 118
A bit late answer, but:
- why (and what) do you want to save to database? Routes are usually written directly in your app's code, which is the correct solution in 99% cases.
- what is exactly your problem? you don't know how to write routes properly? Why don't you use something like this: https://doc.nette.org/en/2.4/routing#… ?