I will summarize. Please correct me, wherever I can formulate my question correctly.
I have several PHP pages, all of them have the following format:
<?php
include "header.php";
?>
INSERT PAGE SPECIFIC MATERIAL HERE
<?php
include "footer.php" ?>
header.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<navmenu></navmenu>
footer.php
<footer></footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
I am new to PHP and not sure if this is the right way to efficiently structure my PHP files because my problems are:
- Each PHP page now loads the same navigation menu and footer. It is provided and suitable . However, it also loads ALL CSS and JS together, even if there are many lines of CSS and JS, where it is not really useful on this particular page, but is used on other pages . This is necessary for concern, and if so, in what ways should we do this?
- main.js, style.css, header.php footer.php, PHP , ?
- ?
, - !