Hi all, this post is pretty general but I want to use PHP so that’s why it is here.
I have a thorough understanding of PHP and have been developing websites for a few years now, I want to take this one step further and start creating fully dynamic websites from scratch as they would be in industry or fully scaled projects like PHPBB or any PHP CMS system.
At the moment I structure my sites with 1 page that contains the main template for the website, and somewhere inside that where I want the content, I would put a script like so:
[code=php]if($_GET[‘page’]({
include(‘./’ . $_GET[‘page’] . ‘.php’);
}
Obviously I would put in some error checking and that. Is this the most efficient way of doing it? I read through some articles but most of them said to design a template and include specific files such as sidebar.php and footer.php. The only problem I see with this, is that if I have 20 pages, and I wanted to move the sidebar.php to the bottom, I would need to move the <div> tags on all of the 20 pages.
If you use my way, you only need to edit 1 page and the content doesn’t need to be edited in turn. Any tips and pointers in the right direction?