Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Posts
    9

    Question Unanswered: Facebook add like button PHP

    Hi, I have problems with add like button for fb. Because I have many articles on site, any of this have own id. URL for some my articles is:

    http: //www.ustedi.034.rs/index.php?=detalji?12

    But when add like button, and click on them, i get this URL on facebook pages:

    http: //ustedi.034.rs/index.php?=detalji%3F12

    Why "%3F" replace "?"

    My code for like button is

    <?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;
    }
    ?>

    <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo curPageURL();?>; layout=button_count&amp;show_faces=true&amp;width= 148&amp;action=like&amp;colorscheme=light&amp;heig ht=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:148px; height:21px;" allowTransparency="true"></iframe>

    Anyone can help me ?

  2. #2
    Join Date
    Dec 2010
    Posts
    1

    sestrucc Thus

    user urlencode()...see the php function documentation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •