Jump to content

Creating Header Files


Xplorer4x4

Recommended Posts

I am trying to take the content of my header on my site http://4x4submods.tk and convert it from being in every single php file to being a single header.php file that I can parse using

include 'header.php';



I have taken the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>4x4 Submods</title>
<meta name="keywords" content="something, something else, etc">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
  <div id="logo"><a href="index.php" class="logo" ></a></div>
  <div id="banner"><img src="images/main-image.jpg" alt="Main Image" /></div>
  <div id="nav">
    <ul>
      <li class="nlink"><a href="index.php">Home</a></li>
      <li class="nlink"><a href="lamod4x4.php">LA Mod 2.1 4x4 Submod</a></li>
      <li class="nlink"><a href="lamod4x4-w00ds-map-v1.php">LA Mod 4x4 w00d's Map v1</a></li>
      <li class="nlink">                 </li>
      <li class="nlink">                 </li>
      <li class="nlinkend"><a href="donate.php">Donate</a></li>
      <!--<li class="nlinkend">                  </li>-->
    </ul>
 </div>


And inserted it in header.php and tried using include 'header.php' in test.php(http://4x4submods.tk/test.php) but it's not calling the header file and parsing it. What am I missing?

Link to comment
Share on other sites

Are you sure that is the HTML code you have in header.php.

 

Because the HTML in header.php on your site is different (right click > view source code) is this


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-55928631-1', 'auto');
  ga('send', 'pageview');

</script>
<title>4x4 Submods</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

Right clicking view source on your test.php shows those 18 lines at the very top. Which indicates header.php is being loaded. If it didn't PHP would of outputted an error message

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.