Closed kvvaradha closed 2 years ago
You cannot get the "url" or "link" of all routes because it just does not exist inside the data. For example the route /user/([0-9]*)/edit
can have the url /user/7/edit
and also the url /user/4/edit
. You cannot convert this pattern to a link.
Instead you should have an array or a database table holding your navigation entries. You can use this for generating menus. But routes and URLs are two different things. A router is not a link or navigation generator.
Not all routes dude, some the main routes like few main pages might we have, that's only we can save it with a page title. and re call them when we prepare the menu and current page highlight options.
!??! I still don't get it. Please try to create complete sentences.
THere is no use for that since you always route part of your output ready (ex: /user/([0-9]*)/edit). but if you still want to know the complete url, a basic php code like this should work:
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
With help of allroutes code, we need to get the entire list of routes with its full url and name or title of the page. If we pass additional parameter title to the Route:: add and get it working with name of the link, which is fine to organize them.