Click to See Complete Forum and Search --> : site in 1 file displaying using get or in 5 different files?


bennystylee
10-20-2008, 03:42 AM
So I'd like a few opinions on this as Im new to php and wondering which is the best way to go.....

Should i make a site or say a section of a site in one file and then use the get url to display different sections of that file

i.e

url = example.com?location=about

if ($_GET = 'about') display this

or should i put these "seperate sections" into different pages and reference them? i.e about.php, work.php, etc.....


What do you think are the advantages/disadavantages of the two above methods and do you have any other/better methods?

thanks

bourkey08
10-20-2008, 04:01 AM
Either way will work but i would avoid using php to display the other files unless you have to because links like example.com?location=about are not search engine freindly and may lower your page rank.

url = example.com?location=about
//dont forget to specify what value you want to retrive
if ($_GET['location'] = 'about')
{ display this}

bennystylee
10-20-2008, 04:15 AM
Thanks

So just as a pondering question what are the limits on this file size wise? As in what if I had a php file that was 100k containing different sections referenced as mentioned above by get would this cause performance issues? is this good practice (i can imagine that seperate files would be managed easier)

Kind of thinking out loud on this, but its always good to have experienced opinons on stuff

Thanks

bourkey08
10-20-2008, 04:24 AM
There are not definite file size limits. However if you want to use one php file to display multiple pages you would be better off having each page in a separate file and just including them using php include(""); this would decrease loading times and server resouces as the entire script would not have to be read into memory.

Example
address: www.yoursite.com/?page=about

<?php
$address = $_GET['page'];
include($address.'.php');
?>


This displays the page about.php
or you could directly access the page
www.yoursite.com/about.php

bennystylee
10-20-2008, 04:54 AM
perfect thanks