开发者

Facebook quote application error

开发者 https://www.devze.com 2022-12-26 19:09 出处:网络
How do I code a Facebook quote application taking its data from PHP/MySQL page generating quotes randomly? I\'ve already developed one, but it\'s using jQuery which FBML doesn\'t support and since I\'

How do I code a Facebook quote application taking its data from PHP/MySQL page generating quotes randomly? I've already developed one, but it's using jQuery which FBML doesn't support and since I'd like the profile tab I'd rather go for FBML instead of iframe.

How to do this without jQuery or using开发者_如何学运维 FBJS?

<!DOCTYPE html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="css/jquote.css" />

        <!--<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>-->

        <script type="text/javascript" src="fbjqry/utility.js"></script>
        <script type="text/javascript" src="fbjqry/fjqry.js"></script>
        <script type="text/javascript">
            // On page load, fill the box with content.
            $(document).ready(function() {
                $("#quoteContainer").load("quote.php");
            });

            var auto_refresh = setInterval(
            function ()
            {
                $('#quoteContainer').load('quote.php');
            }, 5000); // refresh every 10000 milliseconds
        </script>

    </head>

    <div id="wrapper">
        <div class="header">&nbsp;Quote of the Day</div>
        <div id="quoteContainer">
        </div>
    </div>
</html>


That's a pretty broad question, but basically you have two options with Facebook. You can make an FBML application, and have your client-side scripting limited to FBJS, or you can make an iframe application, and utilize whatever Javascript libraries you want.

The intermediate solution is to put iframes in your FBML pages using the <fb:iframe> tag. The iframes will let you use full Javascript, but of course you can't modify anything outside the iframe using code from inside it. It can be a good tool though, you just have to design your UI properly.

You mention that you use JQuery, but you don't really say what for. If you're worried about AJAX functionality, FBJS provides that. If you want fancy effects, then you might be out of luck, as FBJS can be pretty limiting.

Another thing to keep in mind is that profile tabs get their own URL, so they can be pointed to completely separate code than the main application. For example, if your main app is served from http://yourapp.com, in the Developer settings you can set the Profile Tab to be at http://yourapp.com/profiletab. There's no reason you couldn't serve out an iframe app as the main application, and just code up some FBML output for the Profile Tab.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号