PHP标题和元标记动态

问题描述:

我正在设计一个动态布局,每个页面都包含在index.php中。
在该页面中没有任何代码。只是内容。 这是我的指标是由这个或其他作品产生PHP标题和元标记动态

<html> 
<head> 
    <title>Text | <?php echo'$text;'?></title> 
    <meta http-equiv="Content-Language" content="it" /> 
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> 
    <link rel="stylesheet" type="text/css" href="template/style.css"> 
    <link rel="stylesheet" type="text/css" href="config/jsmenu.css"> 
    <link rel="stylesheet" type="text/css" href="config/menu.css"> 
    <script type="text/javascript" src="config/expand.js"></script> 
    <script type="text/javascript" src="config/jquery-1.5.2.min.js"></script> 
    <script type="text/javascript" src="config/scriptbreaker-multiple-accordion-1.js"></script> 
    <script language="JavaScript"> 
     $(document).ready(function() { 
      $(".topnav").accordion({ 
      accordion:false, 
      speed: 500, 
      closedSign: '[+]', 
      openedSign: '[-]' 
      }); 
     }); 
    </script> 
</head> 
<body> 
     <div id="container"> 
      <div id="banner"><?php include('template/banner.php') ?></div> 
      <!--<div id="nav_main"><?php include('template/nav_main.php') ?></div> --> 
      <div id="navigation_left"><?php include("template/link_left.php") ?></div>  
      <div id="navigation_right" align="left"><?php include("template/link_right.php") ?></div>        
      <div id="content"><?php include("$page.php") ?></div> 
      <div id="footer"><?php include('template/footer.php') ?></div> 
     </div> 
</body> 
</html> 

$页包含在link_left.php或link_right.php

<?php 
     isset($_GET["page"]) ? $page=$_GET["page"] : $page="home"; 
     $links=array(
      "fmp_trama" => "Full Metal Panic!", 
      "fumoffu_trama" => "Full Metal Panic? Fumoffu", 
      "fmptsr" => "Full Metal Panic! TSR", 
      "riassunti" => "Riassunti Episodi", 
      "manga" => "Manga", 
      "listamanga" => "Lista Manga", 
      "lnrecensione" => "Romanzo", 
      "romanzi" => "Lista Romanzi", 
      "sigma" => "Sigma", 
      "overload" => "Overload", 
      "comicmission" => "Comic Mission", 
      "another" => "Another", 
      "sdnefd" => "SDNED", 
      "zero" => "Zero", 
      "riassunti_manga" => "Riassunti Manga", 
      "riassuntiromanzi" => "Riassunti Romanzi" 
     ); 
     foreach($links as $href=>$text){ 
      if($page!=$links){ 
      echo '<li><a href="?page='.$href.'">'.$text.'</a></li>'; 
      }else{echo $text;} 
     } 
    ?> 

我因子评分足以为标题添加但不工作。我不知道如何处理关键字和描述。我不使用数据库。

这是将被包含页面的一个例子:
使用example.php:

<p style="background:#ffa"> 
    Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod tempor 
    incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud 
    exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute 
    irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla 
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui 
    officia deserunt mollit anim id est laborum. 
    </p> 
+0

试试这个 '如果($页!= $ HREF){' – RST 2014-09-25 21:39:49

+0

请澄清你的问题,你试图实现的,我知道你想包括meta描述和Meta关键字动态是什么每页的基础上,是吗?问题是你没有访问你的“page.php”中的meta – XhkUnlimit 2014-09-25 21:52:28

+0

RST:没有任何变化 @XhkUnlimit:没错。其实page.php不存在。菜单创建?页面。 .php是告诉那个页面加载一个.php文件。我不知道我是否解释得很好。 – Shika93 2014-09-25 21:53:46

运用@RST 修改例和说明问题,这里是一个适合您的需求的可运行。 你只需要添加一个页面参数,它似乎适合。请检查其他地方,如果它仍然不能在你身边(Php设置等)。

Runnable Code

+0

不起作用。 $ page是一个变量,而不是文件。我添加了一个页面示例,将加载为“$ page.php” – Shika93 2014-09-25 22:02:19

+0

请参阅上述修改^^ – XhkUnlimit 2014-09-25 22:14:59

+0

完成 http://runnable.com/VCSbKdI0-Ocuiy-w/output http://runnable.com/ VCSYsvEy0xov2fNi/my-for-php 没有图片 – Shika93 2014-09-25 22:45:45