I currently have a very simple page, with some more complicated backend. I've always done this the same way, but I feel it's not right. But I haven't come up with much useful to me.
I've got my index.php, header.php and function.php. index.php includes header.php, which calls a function from function.php. The main thing I'm not sure about is how to make the website dynamic enough that it can have easily editable pages, but also be easily editable is a big part of it needs editing.
index.php
<?php
session_start();
include_once 'header.php';
?>
// Page content
</body>
</html>
header.php
<!DOCTYPE HTML>
<html lan="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<?php
require_once 'functions.php';
getBar(); // Top of page bar with menu/login etc
?>
I don't think showing functions.php would add that much. I know I shouldn't use 2 <head>
s in my file, so what do I do if I want to have a description on each page? I've previously had the files setup like:
index.php
<?php
session_start();
include_once 'header.php';
?>
// extra page specific stuff here, such as description or JS
</head>
<body>
<?php
require_once 'functions.php';
getBar(); // Top of page bar with menu/login etc
?>
// Page content here
</body>
</html>
header.php
<!DOCTYPE HTML>
<html lan="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
However, I think the files are "fragmented". I don't know if there is a generally accepted way of doing this, but if there is, I'd love to hear it!