2011-01-31 87 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:' 
    });