0

When I try to include my header in my page, I get a white bar above my page. When I inspect this page it says all the content of the is standing in the and the is empty. I don't have this on every page, just some, eventhough it's the same header. When I copy the content of this header into the page instead of using an include, I don't have this problem.

This is the code I have in my header:

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Flower Power</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no">
<meta name="description" content="Default Description">
<meta name="keywords" content="fashion, store, E-commerce">
<meta name="robots" content="*">
<link rel="icon" href="../afbeeldingen/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="../afbeeldingen/favicon.ico" type="image/x-icon">

<!-- CSS Style -->
<link rel="stylesheet" type="text/css" href="../stylesheet/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../stylesheet/font-awesome.css" media="all">
<link rel="stylesheet" type="text/css" href="../stylesheet/revslider.css" >
<link rel="stylesheet" type="text/css" href="../stylesheet/owl.carousel.css">
<link rel="stylesheet" type="text/css" href="../stylesheet/owl.theme.css">
<link rel="stylesheet" type="text/css" href="../stylesheet/jquery.bxslider.css">
<link rel="stylesheet" type="text/css" href="../stylesheet/jquery.mobile-menu.css">
<link rel="stylesheet" type="text/css" href="../stylesheet/style.css" media="all">
<link rel="stylesheet" type="text/css" href="../stylesheet/responsive.css" media="all">

<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,700,800' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700' rel='stylesheet' type='text/css'>
<meta name="viewport" content="initial-scale=1.0, width=device-width">

</head>

The page with this problem is http://ctimmers.gcmediavormgeving.nl/account

The page I include it in starts like this

<?php include 'templates/header.php';?>

  <div class="page-heading">
    <div class="container">
      <div class="row">
        <div class="col-xs-12">
        <div class="page-title">
<h2>Dashboard</h2>
</div>
        </div>
      </div>
</div>

and ends ofcourse with: </body></html>

Casper
  • 7
  • 1
  • 1
  • 8
  • 3
    wouldn't that mean there is something wrong with the code *inserting the header* rather than with the header itself? – Timothy Groote Nov 23 '17 at 08:22
  • 1
    You've given exactly the wrong information to help us determine what the problem is. – Timothy Groote Nov 23 '17 at 08:23
  • I wouldn't think so, since some pages are almost the same and dont have this problem. I use – Casper Nov 23 '17 at 08:25
  • We can't see *how and where* you call that include. if you do that include *in the body* of a page (that may aready have a header) you should expect the included header to be inserted in the body of that page. – Timothy Groote Nov 23 '17 at 08:26
  • See my edit please – Casper Nov 23 '17 at 08:29
  • i can see strange chars just below the body tag in chrome inspect element – Gumma Mocciaro Nov 23 '17 at 08:29
  • The include is in the body of the page btw – Casper Nov 23 '17 at 08:30
  • @Casper well that explains it then. don't include a header in the body of your page. – Timothy Groote Nov 23 '17 at 08:30
  • Gumma, you're right, the problem is I don't see these characters in my file... when I remove them in inspect they seem to disappear – Casper Nov 23 '17 at 08:31
  • (this may get confusing since the page where you did the include might have been inside another page as an include already. try looking for the topmost page, and include your header there) – Timothy Groote Nov 23 '17 at 08:31
  • 1
    check this https://stackoverflow.com/questions/6538203/how-to-avoid-echoing-character-65279-in-php-this-question-also-relates-to-java – Gumma Mocciaro Nov 23 '17 at 08:32
  • 1
    Thanks guys, I guess this BOM file is the problem, since I use a notepad txt file to drop it in my FTP and then change the filetype. This seems to add the BOM stuff. – Casper Nov 23 '17 at 08:38
  • 1
    looks like you found (copied) the code used in your header file somewhere, thus you brought back some unicode character with you. open your file with most basic notepad. the character `` should appear. delete it and everything should work fine – Franck Ngako Nov 23 '17 at 08:39
  • @Casper the header is still being inserted in the body if you've fixed only the BOM problem. – Timothy Groote Nov 23 '17 at 08:51
  • @TimothyGroote The problem is solved and my head is closed and the body opened just the way it's supossed to be, but thanks – Casper Nov 23 '17 at 08:55

1 Answers1

0

Ok so I created a file in notepad++ instead of just notepad and it seems that it didn't add the BOM code with those weird character. I copied the code to it and replaced it with the old file. The problem is solved now.

Casper
  • 7
  • 1
  • 1
  • 8