Results 1 to 5 of 5

Thread: How do I get the URI of the current web page from my Drupal theme?

  1. #1
    Join Date
    Jun 2009
    Posts
    56

    How do I get the URI of the current web page from my Drupal theme?

    Hi,
    I have a website content development and web designing. And I this web site I need to create a drupal structure with the home page and up to 3 internal page templates. All the image and graphic work done in the Photoshop and CorelDraw, using this site I want to uploaded some text data with the additional pages and also I want to manage all the content of this site and in my requirement I want to get the URI of the current web page from my Drupal theme? So please share your knowledge with me

  2. #2
    Join Date
    Apr 2008
    Posts
    2,276

    Re: How do I get the URI of the current web page from my Drupal theme?

    Hey I tell you about the Uniform Resource Identifier (URI),Uniform Resource Identifier is a is a string of characters and it is use to identify a name or a resource on the Internet. Uniform Resource Identifier help to identify and enables interaction with representations of the resource over a network, with the help of some protocols. These protocols are concrete syntax and associated protocols define each URI. I think this information will increase your Uniform Resource Identifier (URI) knowledge.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,358

    Re: How do I get the URI of the current web page from my Drupal theme?

    Hey used following in this code you get your own URL link, this code mostly use for “Back to Top” and same like this but following code is for “Back to Top” code, you able to edit this code.
    This is PHP code:
    <a href="/<?php print url($_GET['q'], NULL, NULL, TRUE); ?>#top">your message </a
    This is DRUPAL code:
    drupal_get_path_alias(reqURI())
    This code will work on all types of version
    $your_current_url = "http://" .$_SERVER['HTTP_HOST'].$_SERVER['REQURI'];
    I'm the Proud Owner of the most dangerous weapon
    known to man kind: Human Brain

  4. #4
    Join Date
    Apr 2008
    Posts
    2,572

    Re: How do I get the URI of the current web page from my Drupal theme?

    I think you have to use this following code because you use drupal theme and in your requirement you have to use drupal theme for URI retrieving, I use this same code successfully with my drupal theme.
    <?php
    function reqURI() {

    if (isset($_SERVER['REQURI'])) {
    $uri = $_SERVER['REQURI'];
    }
    else {
    if (isset($_SERVER['argv'])) {
    $uri = $_SERVER['SRPTNAME'] .'?'. $_SERVER['argv'][0];
    }
    else {
    $uri = $_SERVER['SRPTNAME'] .'?'. $_SERVER['QUERY_STRING'];
    }
    }
    $uri = '/'. ltrim($uri, '/');

    return $uri;
    }
    ?>

  5. #5
    Join Date
    May 2008
    Posts
    2,792

    Re: How do I get the URI of the current web page from my Drupal theme?

    Hey following codes are use for test and then decide for implement.
    $curr_uri = check_plain(request_uri());
    If you don’t use the check_plan in your code then use following code and using following code you can get the Drupal page URI like this:
    $curr_uri = request_uri();
    but my suggestion for you to use check_plain method, it will help you to URI is properly encoded.

Similar Threads

  1. Cannot change homepage in Firefox 12 to 'use current page'
    By Cheeru in forum Technology & Internet
    Replies: 6
    Last Post: 29-04-2012, 03:21 PM
  2. develop web report: display Current page and Total pages
    By freezea in forum Software Development
    Replies: 1
    Last Post: 25-05-2011, 12:03 AM
  3. My current home page doesn't display on desktop
    By matbiec in forum Window 2000 Help
    Replies: 2
    Last Post: 29-12-2010, 12:40 AM
  4. How to find out Current Page Url with the help of JavaScript?
    By Kushan in forum Software Development
    Replies: 3
    Last Post: 21-11-2009, 10:40 AM
  5. Is it possible to get the current URL in my JSP page
    By Sean J in forum Software Development
    Replies: 3
    Last Post: 19-05-2009, 09:27 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,144,350.27712 seconds with 17 queries