All code in 1 page or divide it to more pages?

I have a social network site with a page user profile. This page has tabs About me, My friends, My information, References.

Is it better for performance to get section via $_GET or to create for each section a new page?
so a)

//display About me sectino
//display friends section
//display references section
//display my information section

To create aboutme.php, myfriends.php, references.php, myinformation.php
Same as a), but instead putting all code inside profile.php include for each section file.


What is the best way of doing it?

Thank you

Pages that don’t share anything in common should be kept separate. It’s usually easier to maintain code that way.

Think about doing it the other way around - use a common header file for all of the other pages. Easier to maintain common code that way.

i think even if you start into single page ,you will later move onto separate page approach yourself,feeling the heat and complexcity as application grows :smiley:

so i recommend separate pages with common layout method…

Or, have your cake and eat it.



include 'aboutme.php' ;


Maybe are you worried about mulitple urls for users?

(with mod_rewrite this could be /aboutme )

Or even:


include '' ;




With your first approach you’re heading towards an unmaintainable mess of code in a single file :eek: - this is not the way to go.

With the second approach you’re delaying the same inevitable problem as the first.

With the third approach, separate files for each distinct page with two (or more) levels of controllers to pick the correct page you’ve got room to grow and the added benefit of a lot more flexibility & re-use.

Attached: directory layout of the small-ish source tree I’m currently working on.

in addition to all above this is age of MVC…
where even single file single is divided into 3 or more files :slight_smile:
so when we consider all those initial methods seems like an ice age :smiley:
just kidding…but time is proving it as truth