Jump to content

Recommended Posts

I'm trying to incorporate PHP into my sites to make my life a bit easier in the long run..

 

So could a few of you experienced programmers give me some insight on how you structure your sites,

should I build one index.php file and my additional pages load into that index file? or should each page be in a sub folder or all pages on the root?

 

if anyone has a little time to shed some light on the best structure they found that worked for them

 

thanks guys

Link to comment
https://forums.phpfreaks.com/topic/174619-php-includes-site-structure-question/
Share on other sites

I personally like to keep all my files in one folder. I hate structure. But lately in doing proffessional work, I've been told to put includes in a subfolder, styles in another subfolder, classes in yet another, and admin files in a fourth subfolder. But I still keep all my main page in the root

I'm pretty OCD about file structure, so I like having folders for raw HTML includes, images, CSS files, etc.  I find that a consistent file structure across projects makes it easier for me to port over various bits and pieces, as I know how my sites are laid out physically.

 

In terms of site structure - how a script is organized programmatically to deliver the desired content to the user - it depends on how complex the site is.  Bigger sites benefit from some sort of controller resting on top of everything, delegating request information to the parts of the script that need it.  Smaller sites benefit from a more direct approach, without that kind of overhead.  There's no one-size-fits-all solution.  Instead, it all depends on what the site needs to do.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.