Welcome Guest, Not a member yet? Register   Sign In
Adding get routes name feature
#7

(This post was last modified: 07-23-2017, 01:48 AM by PaulD.)

If you are referring to only the current path, then you can get that using the URL segments

https://www.codeigniter.com/user_guide/l...s/uri.html

However, if users are changing the route names, then this will not help with things like your main navs, or links to other pages.

How I would do this is to have your page details with an additional column, like page_url. You can auto generate this from the title (checking for uniqueness on creation of course) or have your users input their url manually. Either way, you can then have an option to have the user change the url with just a normal form post on some sort of admin screen.

When showing the page, the page controller would decode the url to a page id. Or when creating navs, your controller would collect all the relevant urls for a foreach. I would never normally allow a user to define routes. That seems to be a recipe for breaking the site.

Best wishes,

Paul.

PS I have not used laravel for a very long time but I think...

For
Code:
Route::getCurrentRoute()->getPath();
This gets the actual path? You could use:
Code:
ruri_string()

For
Code:
Request::route()->getName()
This gets the route name used in the URI? You could use:
Code:
uri_string();

https://www.codeigniter.com/user_guide/l...tml#CI_URI
Reply


Messages In This Thread
Adding get routes name feature - by DuoS - 05-02-2017, 09:37 PM
RE: Adding get routes name feature - by mt19 - 05-13-2017, 03:50 AM
RE: Adding get routes name feature - by DuoS - 07-14-2017, 10:34 AM
RE: Adding get routes name feature - by ciadmin - 07-14-2017, 11:11 AM
RE: Adding get routes name feature - by Wouter60 - 07-14-2017, 01:20 PM
RE: Adding get routes name feature - by DuoS - 07-22-2017, 08:48 PM
RE: Adding get routes name feature - by PaulD - 07-23-2017, 01:39 AM
RE: Adding get routes name feature - by jonathanq - 08-04-2017, 04:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB