Jump to content

How to correctly structure php file

Go to solution Solved by BorysSokolov,

Recommended Posts

Hi everyone.


I create a website and now i want to optimize it and well structure it. Actually, all php file are in root directory and i want to well structure it.


Is there a better way to structure it? i mean, include file should be with or not with display php page?, And what about processing page that validate form and inserting/update row in database then redirect to another page... they should be in their own folder?


Thanks for your help.



Link to comment
Share on other sites

  • Solution

The general rule is to separate the logic from the markup. As far as file structure goes, there isn't a single, definite way. Commonly, the index would be in the root directory, and the includes, stylesheets, javascript, and any additional files would be divided into separate folders.

Link to comment
Share on other sites

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.

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.