HTML in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jollywg
    New Member
    • Mar 2008
    • 158

    HTML in PHP

    I need to embed a bunch of html code that i have into a PHP file so that i can share it between multiple files. Basically what I am doing is I have a menu structure that I dont want to edit two dozen times whenever there is a change. I would like to have this in a php file and just include or import the php file into my html web pages. Any help would be greatly appreciated!

    Matt
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    OK, in the file that requires the menu, do this:

    Code:
    <!-- html ... //-->
    <?php include("path/to/menu/file.php"); ?>
    and in file.php (menu file), do this:
    Code:
    <?php
    
        echo "This is the menu...";
    
    ?>
    Simple. You answered your own question - 'include'.

    Comment

    Working...