Displaying in the wrong place

Here is my index.php

header('Content-type: text/html; charset=utf-8');
if (!file_exists($f1)) {
header('Content-type: text/html; charset=utf-8');
echo "<center>
<h1> !</h1>
$f = fopen($f1,"r"); 
$site = fread($f, filesize ($f1)); 
fclose ($f);
require_once "menu_admin.php";
echo "{$site}";

And here is index.tpl (template)

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css"> 
<body class="thrColHybHdr">
<div id="container">
  <div id="header">
    <img src="https://www.igodkb.ru/templates/IGODKBv3/images/logo.gif">
  <!-- end #header --></div>
  <div id="menu">
    <!-- end #mainContent --></div>
    <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
  <div id="footer">
  <!-- end #footer --></div>
<!-- end #container --></div>

Why is my menu showing in the wrong place? In the vverzhu and not under the cap?

Answer 1, authority 100%

The menu was not written to the $menu variable and the string didn’t work as a result


and the menu was just written before the template.