duanbai1370 2012-04-19 10:35
浏览 96
已采纳

为动态加载的内容添加唯一的fb like按钮

I need to add a facebook like button to menu items from a php cp menu –

I’m thinking of pulling in the information from each menu div and having it fill in meta data before sending it to facebook

<div class="menu_content_cell">
<span class="menu_title"><?php echo $menuItem['item_name']?></span>
<?php if($menuItem['item_desc']) {?>                                                    <br />
<span class="menu_description"><?php echo $menuItem['item_desc']?></span><?php } ?>
</div>

to fill in

      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
    <title>Sample</title>
    <meta property="og:title" content="Site Name <?php echo $menuItem['item_name']?>"/>
    <meta property="og:type" content="food"/>

    <meta property="og:site_name" content="Site Name"/>
    <meta property="og:description"
          content="<?php echo $menuItem['item_desc']?>"/>

    <meta http-equiv="refresh" content="0;url=http://www.sample.com/menu.php"/>
  </head>

<body>
</body>
</html>

is this possible, or am I barking up the wrong tree?

How would I do it? Maybe if I could get a unique id for each menu item - I'm sure this is possible but I'm struggling to piece the parts of the puzzle together

Thanks in Advance

  • 写回答

2条回答 默认 最新

  • donglin317704291 2012-04-19 10:41
    关注

    Facebook indexes objects by urls, different urls mean different objects in their graph.

    For example, these pages will be considered different:

    And so, you should differentiate pages which you want users to like by their urls, and based on the dynamic part (either using query string or pretty urls) output different og tags on the server side.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度