在文章页面中添加开放图形标记

时间:2011-05-31 08:01:13

标签: php facebook http-headers opengraph

如何将differents meta(opengrapg)标记添加到每个动态创建的页面(www.page.com/index.php?page=article&id=1),我试着将其放在文章页面中:

<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>

 <meta property="og:title" content="<?php echo $title?>" />
 <meta property="og:type" content="article" />
 <meta property="og:url" content="http://www.page.com/index.php?page=article&id=<?php echo $id ?>" />
 <meta property="og:image" content="http://www.page.com/image.png" />
 <meta property="og:site_name" content="eeeeee" />
 <meta property="og:description" content="<?php echo $desc; ?>"/>
 <meta property="fb:admins" content="blabla" /> 

  </head>

但FB Linter看不到他们 - “所需财产缺失”

我简单地包含了switch function article.php page

$conlibrary="play/pages/"   ;                   
    IF(!isset($_GET['page'])){ 
        $page = 'deafault'; 
    } ELSE { 
         $page = $_GET['page']; 
         $findme = '&';
          $pos = strpos($page, $findme); 
    IF ($pos ===true) { 
        $data = explode("&", $data); 
        $dest =$conlibrary."/".$data[0].".php"; 
        IF (file_exists($dest)) {
            $page = $_GET['page']; 
        } ELSE {
            $page = '404'; 
        } 
    } ELSE { 
        $dest =$conlibrary."/".$page.".php"; 
        IF (file_exists($dest)) {
            $page = $_GET['page'];
        } ELSE {
            $page = '404'; 
        } 
    } 
} 

include($conlibrary . $page .".php"); 

TY

1 个答案:

答案 0 :(得分:0)

您错过了网址中的? ...

www.page.com/?page=article&id=1

www.page.com/page=article&id=1