Jump to content

PHP Website Structure Question


RaythMistwalker

Recommended Posts

ok atm my php website is mostly run off different php files (index.php profile.php etc)

 

I know that i can also display information based on 1 page by using:

index.php?src=profile

 

then use

$src=$_GET['src'];

if ($src == 'profile') {
Show profile section here
}

 

Are there any advantages or disadvantages to doing it this way as opposed to multiple files?

Link to comment
Share on other sites

One advantage is that dynamic page systems like this can be database driven, allowing you to easily add, remove and edit pages. If the developer of the site creates a decent CRUD system, it means even people without web development knowledge can create new content for the site through a web interface. One slight disadvantage is that to some degree it complicates your code as your having to add a large switch statement to include the relevant pages, but depending on your code structure this is generally a really minor point.

Link to comment
Share on other sites

No you still have to create a db connection however if your smart you apply caching and the entire website will be run off on static html pages which get replaced once the user update a page in the back-end.

 

And by update I mean get the new content apply the template and instead of rendering you store it's output to a html file. If your CMS also provides "slugs" like blogs do, you get:

 

about-us.html

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.

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.