nette/web-project

No Cool URL

Closed this issue · 2 comments

I created a project like in the tutorial. But when I click on a link created with n:href macro it gives me a normal URL like post/show?postId=1. Any idea? I followed the tutorial, so I didn't make any change

milo commented

Hi. For questions use forum please (https://forum.nette.org/en/).

But anyway. If you think The Quick start, take a look on RouterFactory::createRouter() method. There is defined the <id> parameter in URL mask, so only the id will be part of cool URL. All others will be standard params in query string.

Try to change signature of PostPresenter::renderShow() method to renderShow($id).

Got it. the macro n:href="Post:show $post->id" set's postId instead of id. Problem solved using n:href="Post:show id => $post->id"

Edit: Actually you are right, changing the $postId param to $id solved the problem.