It would really be better to use a template file by loading the content via parameters in the URL, but if you are used to this structure, and / or prefers to have the file names simply, / p>
contact.php
<html>
<head>
<title>Demo</title>
</head>
<body>
<?php
include('menu.php');
?>
<div class="conteudo">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur eget varius urna. Quisque convallis augue quis magna consequat eleifend. Nulla posuere sit amet lectus sed porta. Ut quis mauris luctus, lobortis ligula et, interdum massa. Praesent varius tempor laoreet. Vestibulum vulputate massa vel nunc vulputate, ut pellentesque massa rutrum. Aenean posuere, arcu eget eleifend auctor, diam lorem volutpat massa, vel commodo quam urna a mauris.
</div>
</body>
</html>
menu.php
<?php
$pagina_atual = basename($_SERVER['PHP_SELF']);
if ($pagina_atual == 'contato.php') {
echo '<script src="js/contato.js"></script>';
}
?>
<ul id="menu" class="clearfix">
<li<?php echo ($pagina_atual == 'index.php' ? ' class="ativo"' : ''); ?>>
<a href="index.php">Início</a>
</li>
<li<?php echo ($pagina_atual == 'sobre.php' ? ' class="ativo"' : ''); ?>>
<a href="sobre.php">Sobre</a>
</li>
<li<?php echo ($pagina_atual == 'contato.php' ? ' class="ativo"' : ''); ?>>
<a href="contato.php">Contato</a>
</li>
</ul>
As you can see, only when the page is contact.php will it include <script src="js/contato.js"></script>
and bonus was an example of how to apply the active class in the menu.