简体   繁体   中英

Facebook application timeline tabs

I have a question about the timeline tabs. I have created an application which has been installed on 2 different business pages as tabs. Now what I want to do is change the content of the tab based on which business page is being viewed. Another company has done this but I can't work out how. Any thoughts?

This is pretty easy to do. If you decode the signed_request data POSTed to your page, you can see what page is 'looking' at your app (ie which page the app has been installed on).

If you decode the data (eg in PHP you can do: print_r( $facebook->getSignedRequest() ); to print the decoded version), you will see something like:

Array
(
    ...
    [page] => Array
        (
            [id] => 1234567890
            [liked] => 1
            [admin] => 1
        )
    [user] => Array
        (
            ...
        )
)

The $response['page']['id'] is the ID of the Page that is looking at your app at that moment. You can store the IDs of the page that have installed your app, and check it with this to determine which content to load up.

You will also notice that the data includes $response['page']['admin'] , which tells you if the user looking at the page is an admin of the page (1=admin, 0=not admin). And $response['page']['liked'] , which tells you if the user looking at the page is a fan (1=fan, 0=not a fan).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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