繁体   English   中英

如何在PHP中从表单中检索值并在Fb.ui中使用它发布到墙函数

[英]How to retrieve a value from a form in PHP and use it in Fb.ui Publish to wall Function

我想制作一个带有表单字段的Facebook页面标签,访问者可以在其中填写一个值,然后按一个发布到墙上的按钮,该值将在fb.ui发布到墙上功能的名称值中使用。

有人可以指出我正确的方向吗?

这就是我用来张贴到墙上的东西。

<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
  FB.init({appId: <APPID>,
              status: true,
              cookie: true,  
              xfbml: true});  };  
     (function() {
         var e = document.createElement('script');
         e.async = true;  
         e.src = document.location.protocol +  
         '//connect.facebook.net/en_US/all.js';
         document.getElementById('fb-root').appendChild(e);
     }());
 </script>

<script>
function publish_to_wall(){
   FB.ui({ 
     method: 'stream.publish',
     display: 'iframe',
     name: '<VALUE TO RETRIEVE FROM FORMFIELD> blablablalba',
     caption: '<TEXT>',
     link: 'http://www.facebook.com/<MYPAGE>',
     picture:'<IMAGE URL>'
   });
 }
</script>

要查看选项卡,可以在此处查看: http : //www.socialogika.com/tabs/hp/index.html

目前,formfield仍然是图像,并且“共享”按钮尚未激活...但是它使您可以更好地了解我要实现的含义...

该按钮应直接启动弹出对话框。

给表单一个id ...然后使用document.getElementById(“ theID”)。value,虽然不是一个真正的facebook问题...

干杯

扩展示例:

<input type='text' id='myText' />


<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
  FB.init({appId: <APPID>,
              status: true,
              cookie: true,  
              xfbml: true});  };  
     (function() {
         var e = document.createElement('script');
         e.async = true;  
         e.src = document.location.protocol +  
         '//connect.facebook.net/en_US/all.js';
         document.getElementById('fb-root').appendChild(e);
     }());
 </script>

<script>
function publish_to_wall(){
   FB.ui({ 
     method: 'stream.publish',
     display: 'iframe',
     name: document.getElementById('myText').value,
     caption: '<TEXT>',
     link: 'http://www.facebook.com/<MYPAGE>',
     picture:'<IMAGE URL>'
   });
 }
</script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM