File and Design Structure (General)
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:
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.
include('./' . $_GET['page'] . '.php');
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?
The approach you're using is actually the same as what the major frameworks. You should stick with what you've been doing.
If you're looking for any further design structure ideas, the article From Flat PHP to Symfony2 is a nice step by step guide.
Thanks for the link Jeff! I just skim read it and that is exactly what I have been looking for. I had no idea my way of doing things was right, I just thought I was hacking code together with no real structure. Thanks once again.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)