Define variable as current url

Discussion in 'PHP' started by martinvidic, Apr 3, 2007.

  1. #1
    Hellovrybody

    Can anybody give me a short script to define the variable "ID_01" as the current url.

    Thanx.
    m
     
    martinvidic, Apr 3, 2007 IP
  2. Rub3X

    Rub3X Well-Known Member

    Messages:
    1,902
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    135
    #2
    $id_01 = $_server['server_name'];
     
    Rub3X, Apr 3, 2007 IP
  3. PHP5-Hosting

    PHP5-Hosting Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Do you mean something like this:

    $ID_01 = substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/')) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     
    PHP5-Hosting, Apr 4, 2007 IP
  4. PHP5-Hosting

    PHP5-Hosting Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Or like this:

    define("ID_01", substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/')) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     
    PHP5-Hosting, Apr 4, 2007 IP
  5. martinvidic

    martinvidic Guest

    Messages:
    182
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanx... for all the info...
    Yes i think thats what i was looking for...
    I will try out all three of them

    I am trying to add dynamic ids to Masugas Rating Bar...
    But before i can try it i still have to fix another problem.
    Does anybody here have experince with his rating bar.

    In my case only one vote can be given.....
     
    martinvidic, Apr 4, 2007 IP
  6. martinvidic

    martinvidic Guest

    Messages:
    182
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The method in post 3 worked...

    But unfortuneately there were other problems after that.

    Is there a way to define $ID_01 as the meta tag "topic_number"

    <meta name="topic_number" content="00001">
     
    martinvidic, Apr 5, 2007 IP
  7. PHP5-Hosting

    PHP5-Hosting Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    This on top of your page:
    <?php
    $ID_01 = substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/')) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    ?>

    Then this in your HTML's Head tag as HTML-centric-PHP:
    <meta name="topic_number" content="<?php echo $ID_01; ?>">
     
    PHP5-Hosting, Apr 9, 2007 IP