Hello! How to make the site so that when you click on a link, a new page opens? Those. There is a 'contacts' item in the menu, when you click on this item (when clicking on the link <a href="contacts"... ), the content should change, and the header and footer should be static. I understand that different pages are connected in the body through include , but how to understand which page to connect to?

    1 answer 1

    In the simplest case, like you (without using template engines), the structure of each page should look like this:

     <?php require "header.php" // content require "footer.php" 
    • And you can not make it so that the content of the page is connected? And how do you understand which page to connect? Read on $_SERVER['REQUEST_URI'] I understand it will not work - r.mcreal
    • If you want without rebooting, then Ajax. - Boris Ustyantsev
    • What does it mean to understand? You yourself write something like <a href="contacts.php"> in the link. The contacts.php page will be loaded. If its code looks like I wrote in response, then the footer and header will be standard. - Boris Ustyantsev
    • If you copy the link and put it in a new window, then this link will open with ajax? - r.mcreal
    • If you prescribe <a href="contacts.php"> in the address bar to be /contacts.php , and you just need to have /contacts - r.mcreal