RE: [PHP] Can includes be used for head tags?
| From: | Jay Blanchard | Date: | Mon, 11 May 2009 17:11:59 +0000 |
| Subject: | RE: [PHP] Can includes be used for head tags? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-292450@lists.php.net to get a copy of this message | ||
[snip]
I was thinking of creating a php include for the <meta> tags for a site.
Is
this possible?
[/snip]
Here is one model...
<?php
session_start();
include("inc/dataConnect.inc");
/* see if anyone has logged in, if not call the login form */
if("" == $_SESSION['user']){
include("head_of_file.php");
include("login.php");
include("tail_of_file.php");
} else {
/* display head of file */
include("head_of_file.php");
/* now use cases to display proper forms */
switch ($_GET['form']){
case "foo":
include("foo.php");
break;
case "bar":
include("bar.php");
break;
case "glorp":
include ("glorp.php");
break;
}
/* case is chosen, display tail of file */
include("tail_of_file.php");
}
?>
Hear is head_of_file.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en_US"
xml:lang="en_US">
<head>
<title></title>
<link rel="stylesheet" href="css/primary.css"
type="text/css" />
<script type="text/javascript"
src="inc/jquery-1.1.3.1.js"></script>
</head>
<body>
<div id="content">
<div id="header"> </div><!-- /header -->
<div id="leftContent"></div><!-- /leftContent
-->
<div id="rightContent">
Here is tail_of_file.php
</div><!-- /rightContent -->
</div><!-- /content -->
<div id="footer">
<p style="text-align: right; font-size: 0.7em;
font-weight: bold;">Copyright ©2007</p>
</div><!-- /footer -->
</body>
</html>