Ok, so this is driving me nuts, because I can't see why it's happening.
Simple code:

<html>
<head>
<meta name='author' content='TonyG' />
<meta name='description' content='' />
<meta name='keywords' content='' />
<title></title>
<link rel='stylesheet' type='text/css' href='css/style.css' media='all'/>
<link rel='shortcut icon' href='favicon.ico'>


</head>
<body><div class='container'>
<div class='header'></div>
<div class='content'>
<div class='navi'>

<ul class='item'>
<li><a href=''>Birthday</a></li>
<li><a href=''>New Baby</a></li>
<li><a href=''>Anniversary</a></li>
<li><a href=''>Wedding</a></li>
<li><a href=''>Driving Test</a></li>
<li><a href=''>Moving</a></li>
<li><a href=''>New Job</a></li>
<li><a href=''>Retirement</a></li>
<li><a href=''>Good Luck</a></li>
<li><a href=''>Engagement</a></li>
</ul>

</div>
</div>
</div>
<?php

include('php/footer.php');
?>
</body>
</html>

Now if I replace the unordered list with an include of the same list,
i.e

<?php
include('nav.html');
?>

I get this strange symbol above it



when I run it in xampp
It only happens on the one include, not on the footer one, Any clues?

Recommended Answers

All 7 Replies

include can only read .php extention

Works fine for me - are you sure you just have the navigation in your external file, like this?

<div class='navi'>

<ul class='item'>
<li><a href=''>Birthday</a></li>
<li><a href=''>New Baby</a></li>
<li><a href=''>Anniversary</a></li>
<li><a href=''>Wedding</a></li>
<li><a href=''>Driving Test</a></li>
<li><a href=''>Moving</a></li>
<li><a href=''>New Job</a></li>
<li><a href=''>Retirement</a></li>
<li><a href=''>Good Luck</a></li>
<li><a href=''>Engagement</a></li>
</ul>

</div>
Member Avatar for diafol

Several reasons spring to mind. You may have saved the include file with a BOM. If you copy the include file into a new file and then save as UTF8 without BOM (as possible in Notepad++), that'll be the first step out of the way. ALso, you may find that forcing the encoding to UTF-8 might help:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>...</title>
</head>

@code739 I beg to differ.

My guess it's somewhere between the transmission of the unordered list, there were differences between the character sets from the source and the destination. In your case, this might be your editor. If you can, set your editor's character set to your preference, UTF8 will suffice.

Check your editor's setting for charset selection.

Anyhow, for a quick fix, you can copy the unordered list part and paste it in an UNICODE to ASCII converter. You can see a lot of online converter, so you won't have a problem with it.

Thanks for all your input guys, it was encoding, for some strange reason I'd changed the encoding in notepad++ to ansi, don't remember doing it or why I might've, senior moment I guess!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.