[Phpwm] Site Structure

Tom Jemmett tom.jemmett at gmail.com
Fri Dec 9 19:35:56 GMT 2005


On 09/12/05, David Goodwin <david at codepoets.co.uk> wrote:
>
> > Another way of doing this would be a switch statement:
> >
> > switch ($_GET['page']) {
> >   case "pictures":
> >     include ("pictures.php");
> >     break;
> >   case "news":
> >     include ("news.php");
> >     break;
> >   default:
> >     include ("welcome.php");
> > }
> >
> > I think this looks better and is easier to understand when you look
> > back at your code.
>
> Interestingly (?) I did actually write something like that to start
> with, and then thought it would involve less repetition using an array.

An Array uses less repetition, but as I said, I think it is easier to
understand because it is less cryptic than loops and if statements. 
Plus you could have the news page named as something other than
news.php (I think some one pointed this out?)



More information about the Phpwm mailing list