What Path is the current page in Drupal 7

When you are writing code that will fit into a page, how do you know the page you are on.

There are two (2) paths. The Real path that Drupal uses

node/147

Which can be found this function.

current_path();

And the Aliased path that you are actually using. PathAuto will do this for you or you might manually set a path.

article/your-title-here

Which can be found this function.

request_path();

This last value can also be obtained with

drupal_get_path_alias(request_uri());

Leave a comment

Your email address will not be published. Required fields are marked *