current_path() returns the current URL which may not be the current alias (return node/5, not alias like about, services).

Using drupal_get_path_alias() is recommended to always return a friendly alias.

For eg. our path is http://localhost/mysite/students

request_uri()  returns  /mysite/students

base_path() will return /mysite/

drupal_get_destination() returns destination=students

eg <form action=”<?php echo $base_url ?>/sign-up-newsletter?<?php echo drupal_get_destination(); ?>” method=”post” >

it will generate action url http://localhost/mysite/sign-up-newsletter?destination=students

Drupal module path

drupal_get_path(‘module’, $module_name);// user ‘module’ or ‘theme’

returns sites/all/module/mymodule

Advertisements