Xplorer4x4 Posted August 14, 2015 Share Posted August 14, 2015 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? Quote Link to comment https://forums.phpfreaks.com/topic/297788-creating-header-files/ Share on other sites More sharing options...
Ch0cu3r Posted August 14, 2015 Share Posted August 14, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/297788-creating-header-files/#findComment-1518833 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.