2012-02-19 128 views
0

我正在創建一個製作粉絲專頁的應用程序。用戶可以在我的網站上創建自己的頁面設計,並在發佈按鈕上單擊該應用程序,並將其作爲選項卡隨設計製作而添加到頁面中。我有頁面ID和應用程序ID ..請建議一些方法,我可以直接添加選項卡。此外,當我使用在Facebook頁面上添加標籤並添加自定義標籤以添加應用程序並傳遞一些數據

http://facebook.com/add.php?api_key=app_api_key&page=page_id

它顯示添加應用按鈕,我可以更改按鈕的標籤..

回答

1

您可以通過以下電話programagically實現這一目標:

See here for acquiring page tokens (向下滾動到「頁面登錄」)

$page_token = 'XXX' // This is the page token 
$app_id = '123456789' // This is the app that you want to install 
$tab_title = 'My Tab Name'; 

// The following lines of code will install the tab app onto the page. 
$install_tab_call = "/{$page_id}/tabs?app_id={$app_id}&access_token={$page_token}"; 
$facebook->api($install_tab_call,'POST'); 

// The following lines of code will update the tab app's name on the page.    
$change_tab_call = "/{$page_id}/tabs/app_{$app_id}?custom_name={$tab_title}&access_token={$page_token}"; 
$facebook->api($change_tab_call,'POST'); 

因爲您正在使用這些命令來執行您的操作,可以使用任何符合您需求的UI設計 - 無需自定義Facebook用戶界面。只需在調用上述腳本的頁面上放置自己的元素即可。我建議使用AJAX調用。

此外,您可以在文檔中檢查出所有你可以操縱其他設置你的頁面的選項卡:https://developers.facebook.com/docs/reference/api/page/#tabs

請注意,您將需要manage_pages權限來執行處理頁面設置的任何行動。

希望這有助於!快樂的編碼!