How do I include a file?

Here is the code I have in the html file to "include" the "vmenu.php" file

  <div id="apDivVistaMenus">

<?php
include 'vmenu.php';
?>

  <!-- Begin Vista-Buttons.com -->

  <!-- End Vista-Buttons.com -->

  </div>

      

The menu that was used between below php comments includes request. But I keep this code in vmenu.php file which looks like this:

<link href="../menu-files/peaceland_styles_zkkus.css" type="text/css" rel="stylesheet"/>

  <script type="text/javascript"> var vbImgPath="../menu-files/"</script>

  <script type="text/javascript" src="../menu-files/sczkkus.js"></script>

  <noscript><a href="http://vista-buttons.com">Xp Style Menu by Vista-Buttons.com v2.73</a></noscript>

      

What's the problem? They are both in the same directory. If I put the code from vmenu.php back into the html file, it loads fine.

Thank!

0


source to share


2 answers


Note that for PHP to work, the file must be parsed by the PHP engine. By default, large web servers like Apache do not run .html files through the PHP interpreter, so you must either specify in your web server configuration that you want to parse .html files as PHP files, or rename the .html file to a ... php.



+5


source


Change the code as follows:

<div id="apDivVistaMenus">
<!-- Begin Vista-Buttons.com -->
<?php include 'vmenu.php'; ?>
<!-- End Vista-Buttons.com -->
</div>

      



... and you become gold.

0


source







All Articles