If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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:

PHP Code:

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?

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.