What is the equivalent to Master Views from ASP.NET in PHP?
- by KingNestor
I'm used to working in ASP.NET / ASP.NET MVC and now for class I have to make a PHP website.
What is the equivalent to Master Views from ASP.NET in the PHP world?
Ideally I would like to be able to define a page layout with something like:
Master.php
<html>
<head>
<title>My WebSite</title>
<?php headcontent?>
</head>
<body>
<?php bodycontent?>
</body>
</html>
and then have my other PHP pages inherit from Master, so I can insert into those predefined places.
Is this possible in PHP?
Right now I have the top half of my page defined as "Header.html" and the bottom half is "footer.html" and I include_once both of them on each page I create. However, this isn't ideal for when I want to be able to insert into multiple places on my master page such as being able to insert content into the head.
Can someone skilled in PHP point me in the right direction?