I asked this question in the general area and didn't get a response then realized it was probably because I asked in the wrong place. Sorry in advance for the duplicate post.
I'm writing a menu hook and I want to get the current path so I can create a dynamic menu from it. I've found two ways of getting it thus far:
$local_path = str_replace(base_path(),"",request_uri());
$local_path = substr(request_uri(),strlen(base_path())) ;For request_uri is "/drupal/mypath/mysubpath" $local_path will be "mypath/mysubpath."
For request_uri is "/mypath/mysubpath" $local_path will also be "mypath/mysubpath."But it seems like Drupal would have that information available more directly. Is there a global variable or a function I can call to get this? Thanks in advance.
-Mike
Comments
Path from arguments
Try this (not tested):
Thanks, but...
Thanks for the follow up, but wouldn't that be a lot more compute intensive than even the version I suggested and was trying to streamline?
Try using the function arg.
Try using the function arg.