开发者

Workaround for dymanic pages and Facebook-likebox

I've got a prett complex problem (at least to me). I have a dynamic page where everything is loaded using ajax and javascript. This page has 100s of different newsitems, and I'd like to give all of them a unique like-box.

When cliking the like-box, the Facebook-script pings your page and retrives the information.

I've tried the following workaround: the url the Facebook-script is supposted to ping, is controlled by a php-script. If there is a get-parameter set, the default description, title and url is replac开发者_StackOverflow中文版ed by the description, title and url that belongs to the newsitem selected by the get-id.

The problem seemst to be that the Facebook-script ignores the get-parameter and only pings the standard page every time.

Does anyone know in details how this script works, and if it's possible to find a workaround for this?

Thomas


Facebook is notoriously annoying for this sort of thing. First of all note that it caches, so once you like a particular URL so many times (it might 5, not sure), changing what is on the URL will no longer change anything on facebook, even if you like it with a different account or anything.

Anyways, FB doesn't want to follow your GET params, so you'll have to do some custom routing, and do something like http://yourapp.example.com/newsitem/1 , and load your php script with that id.

The details vary based on what framework you're using (and I'm not even a PHP guy : ) ) but I'd just google how to do the routing. Worst case, you can use apache to redirect that url to http://yourapp.example.com/newsitem.php?id=1, so in PHP you don't actually see anything different. You would do this with mod_rewrite.

Sorry if that's annoyingly non-specific : )

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜