Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By sisyphus on
is there any Drupal built-in function to get the current full URL?
thanks a lot.
Comments
you could try request_uri()
you could try request_uri() ... you might also need $_SERVER['HTTP_HOST']
I'm not aware of a drupal
I'm not aware of a drupal function for this, but it's easy enough with PHP:
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
<?phpecho url(NULL,
base url and path to theme and modules
To get the host name like http://www.yourdonmainname.com
use
will give u http://www.yourdonmainname.com
u can extend this by $url=$base_url.path_to_theme();
to get full path to theme.
for module path u can use drupal_get_path('module', 'screencast')
also check base_path() by using the print_r(base_path());
to get full url with the base
to get full url with the base_url has prefix: