Code that auto inserts your page url

Discussion in 'HTML & Website Design' started by WebDivx, Jun 14, 2007.

  1. #1
    Does anybody know of a code (PHP Maybe?) that automatically puts a pages of my sites url in place?

    ok, say my sites url is webdivx.com

    I want to put Digg buttons on my site, but don't want to go through each and every page and manually add one.

    i want it to be like if you visit my index page the digg button will automatically be like

    http://digg.com/submit?phase=2&url=http://webdivx.com/index.php

    or go to the contact page it'll just change to
    http://digg.com/submit?phase=2&url=http://webdivx.com/contact.php

    is that possible? thanks for your help!
     
    WebDivx, Jun 14, 2007 IP
  2. cckid

    cckid Peon

    Messages:
    139
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    do you mean to add that to your links? your post is rather confusing to me.
    with php, you can certainly add that dynamic aspect.
    post more details and i'll try to help.
     
    cckid, Jun 14, 2007 IP
  3. WebDivx

    WebDivx Peon

    Messages:
    212
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks alot, it's really appriciated!

    You know how when you leave the url field empty like this:
    <a href="">anchor text</a>
    it automatically fills in the url of your site when your browse the web page via a browser?

    For example if my page is located at webdivx.com/pizza.html that link automatically parses to
    <a href="http://webdivx.com/pizza.html">anchor text</a> when you view it from a browser


    I want the same thing done in this situation EXCEPT, I want the url "http://digg.com/submit?phase=2&url=" to come before my pages url. Browsers don't auto parse in that kind of situation, so I was wondering if there was a PHP or HTML code that would automatically fill in my url so it would be


    <a href="http://digg.com/submit?phase=2&url=http://webdivx.com/pizza.html">anchor text</a>
     
    WebDivx, Jun 14, 2007 IP
  4. cckid

    cckid Peon

    Messages:
    139
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, there sure is a way with PHP :D

    Consider the following a "pay it forward".

    <?
    $url = $_SERVER['SERVER_NAME'];
    $page = $_SERVER['PHP_SELF'];
    $digg = "http://digg.com/submit?phase=2&url=";
    echo $digg."http://".$url.$page;
    ?>
    PHP:
     
    cckid, Jun 15, 2007 IP