SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb Get PageName + StumbleUpon

    Question at Bottom

    Original StumbleUpon Code:
    HTML Code:
    <a href="http://www.stumbleupon.com/submit?url=http&#37;3A%2F%2Fwww.yoursite.com%2Farticle.php%26title%3DThe%2BArticle%2BTitle"> <img border=0 src=""**LINK TO stumbleit.gif**"" alt="StumbleUpon Toolbar"> Stumble It!</a>
    Getting Page URL for Submit
    PHP Code:
    <?php
    function curPageURL() {
     
    $pageURL 'http';
     if (
    $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     
    $pageURL .= "://";
     if (
    $_SERVER["SERVER_PORT"] != "80") {
      
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return 
    $pageURL;
    }
    ?>
    Inserting Code Automatically:
    Code:
    <a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.yoursite.com%2Farticle.php%26title%3DThe%2BArticle%2BTitle"> <img border=0 src=""**LINK TO stumbleit.gif**"" alt="StumbleUpon Toolbar"> Stumble It!</a>
    Above.. will there be a problem with the %3A figure's and such in the URI? I am not sure if a desciption is required but I don't know how to fetch a page title.

    I will play with it for a moment now and see if I can figure it out to automate this for any page. I posted this in hopes that someone else may have already done this or is also trying to do this. This is not for a blog or wordpress, I did search google and feel close

  2. #2
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess the Title doesnt matter anymore as it adds it auto, so this code works for anyone interested:

    PHP Code:
    <?php
    function curPageURL() {
     
    $pageURL 'http';
     if (
    $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     
    $pageURL .= "://";
     if (
    $_SERVER["SERVER_PORT"] != "80") {
      
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return 
    $pageURL;
    }
    ?>

    <a href="http://www.stumbleupon.com/submit?url=<?php echo curPageURL(); ?>"><img src="/images/icons/stumbleupon.gif" alt="StumbleUpon Toolbar">

  3. #3
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    use HTTP_HOST instead of SERVER_NAME
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  4. #4
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks


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
  •