2011-01-31 61 views
1

我在Facebook FBML應用程序中使用Facebook publishStream方法,其他一些開發人員在我之前使用它。我使用它的一些這樣的事設置Facebook發佈流URL

Facebook.streamPublish('Publish Shirt Tale. <?php echo $canvasURL.'?req=tale-details&tale_id='.$tale_id?>', attachment); 

但還有另一個URL,它是共享的圖像下,見下面的圖片瞭解更多信息 enter image description here

所以在圖像有合抱的鏈接,從而使指向其他頁面,而我想它到應用程序的第一頁。它目前進入一個頁面這樣的一些事情:http://apps.facebook.com/apps/application.php?id=xxxxxxxxxxxxx

所以任何人都可以告訴我在哪裏可以指定該網址?

在此先感謝

+0

檢查$ canvasURL廣告$ tale_id那什麼是變量在他們的價值。它可能發生,他們指向任何其他應用程序。只是回聲這些變量,並看到他們的價值 – 2011-01-31 12:02:50

+0

這些都很好,但我認爲在某些設置有一些問題,但不明白從哪裏我可以設置此 – Hafiz 2011-01-31 12:13:21

回答

3

按照Facebook是deprecating all FBML apps soon,我勸你look here,並嘗試以這種方式創建一個對話框。我可以給你我正在使用的腳本,你圈出的鏈接指向我的應用的主頁。應該做一個筆記 - 我的應用程序是一個Iframe應用程序。

<script type="text/javascript"> 
    FB.ui(
    { 
    method: 'stream.publish', 
    attachment: { 
     name: 'name', 
     caption: 'caption', 
     source: 'picture.jpg', 
     picture: 'picture.jpg', 
     description: 'description', 
     href: 'http://apps.facebook.com/appname' 
    }, 
    action_links: [ 
     { text: 'name', href: 'http://apps.facebook.com/appname' } 
    ] 
    }, 
    function(response) { 
    if (response && response.post_id) { 
     alert('Post was published.'); 
    } else { 
     alert('Post was not published.'); 
    } 
    } 
); 
    </script> 

不過,若你要保持你的應用在FBML形式,試試這個代碼:

<script type="text/javascript"> 
    FB.ui(
    { 
    method: 'stream.publish', 
    attachment: { 
     name: 'name', 
     caption: 'caption', 
     source: 'picture.jpg', 
     picture: 'picture.jpg', 
     description: 'description', 
     href: 'http://apps.facebook.com/appname/index.php' 
    }, 
    action_links: [ 
     { text: 'name', href: 'http://apps.facebook.com/appname/index.php' } 
    ] 
    }, 
    function(response) { 
    if (response && response.post_id) { 
     alert('Post was published.'); 
    } else { 
     alert('Post was not published.'); 
    } 
    } 
); 
    </script> 

您需要了解iFrame和FBML應用程序之間的區別:雖然的Iframe應用軟件可以使用戶始終保持在同一頁面中,並且只有Iframe中的內容發生更改,FBML應用程序實際上將用戶從一個頁面移動到另一個頁面。因此,在FBML應用程序中指定鏈接時,使用http://apps.facebook.com/appname/page鏈接而不是http://www.yoursite.com/page鏈接很重要。

實例鏈接:

  1. 在您的網站的鏈接:http://www.yoursite.com/game1.php
  2. 看起來像這樣在FBML應用:http://apps.facebook.com/appname/game1.php
1

ok Hafiz然後嘗試此代碼。

 
FB.ui({ 
    method: 'stream.publish', 
    message:'hello', 
    attachment: { 
     name: title, 

     caption: "I'm running!", 
     media: [{ 
     type: 'image', 
     href: 'http://www.yoursite.com/', 
     src: 'http://www.yoursite.com/images/working.jpeg' 
     }] 
    }, 
    action_links: [{ 
     text: 'Get your percentage', 
     href: 'http://www.yoursite/' 
    }], 
    user_message_prompt: 'Tell your friends about Get your percentage:' 
    });