Need help adding twitter and facebook like buttons

Discussion in 'PHP' started by dlatua, Jan 1, 2011.

  1. #1
    Hello,
    I have a shortening service site (www.get.al)
    I was thinking to add a twitter button and a facebook button that gets as source the shorted link

    The variable for the url is $url
    I added for the twitter button
    <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="vertical">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    Code (markup):
    But it doesnt work, I get the message "'url' parameter does not contain a valid URL."
    Havent tried yet for the facebook like button.
    What might be the prroblem?

    Thank you
     
    dlatua, Jan 1, 2011 IP
  2. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #2
    do urlencode($url)
     
    tvoodoo, Jan 1, 2011 IP
  3. dlatua

    dlatua Notable Member

    Messages:
    3,985
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    235
    #3
    Can you explain it? I didn't understood you :eek:
     
    dlatua, Jan 1, 2011 IP
  4. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #4
    What is there to explain ?

    You used this code :
    
    <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="vertical">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    
    PHP:
    And I told you to use urlencode($url) right ? That means that the code you've paste will look like :
    
    <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.urlencode($url).'" data-count="vertical">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    
    PHP:
    Is that not obvious ?!
     
    tvoodoo, Jan 1, 2011 IP
  5. dlatua

    dlatua Notable Member

    Messages:
    3,985
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    235
    #5
    Sorry mate, I dont know PHP :eek:
    I did what you said, buy same result "'url' parameter does not contain a valid URL."

    Thank you
     
    dlatua, Jan 2, 2011 IP
  6. php.freak

    php.freak Well-Known Member

    Messages:
    185
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #6
    simple copy and paste the above text in your page.
     
    php.freak, Jan 2, 2011 IP
  7. dlatua

    dlatua Notable Member

    Messages:
    3,985
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    235
    #7
    Yes I did that, but it is not working.
     
    dlatua, Jan 2, 2011 IP
  8. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #8
    How do you assign the value to the variable $url ?!?! Don't you read and try to understand what a man is asking you !?
     
    tvoodoo, Jan 2, 2011 IP
  9. dlatua

    dlatua Notable Member

    Messages:
    3,985
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    235
    #9
    Hello again tvoodoo,
    Here is the ajax.php http://pastebin.com/nusL5qEX where the shourted URL is created.

    I am sorry, but my knowledge in PHP is very low :eek:
     
    dlatua, Jan 2, 2011 IP