Re: Please Help!!!! - Really BASIC stuff!

From: Date: Tue, 06 Mar 2001 21:17:30 +0000
Subject: Re: Please Help!!!! - Really BASIC stuff!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42807@lists.php.net to get a copy of this message
This will allow you to have more control over what pages get edited... but you can use something a little easier like... <? $filename= $page . ".php" include ("$filename"); ?> At 09:02 PM 3/6/01 +0000, you wrote:
Hi Martin, It's important to know that "Stuff" in the Url like this are just variables. For example : foo.php?fruit=apples&dog=snoopy&others=huh&more=yep Now with foo.php we can do this (a few exceptions) : echo "$dog would like to each some $fruit"; And in your case, you have $page so let's compare your $page variable and include files accordingly. We'll be using an if statement which can be read about here : http://www.php.net/manual/en/control-structures.php This will do the job : <?php if ($page == 'visual') {
    echo '<h3>Visual Stuff is Good!</h3>';
    include 'visual.txt';
} elseif ($page == 'audio') { echo '<h3>Welcome to Musical Section!</h3>'; include 'audio.inc'; } else { echo '<h3>Welcome to my site!</h3>'; include 'default.php'; } ?> Yes there are other ways but this is the simplest and you should (and will!) learn to use if/elseif/else which will be useful in the future. Regards, Philip Olson http://www.cornado.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
########################################################## # Rick St Jean, # rstjean@internet.look.ca # President of Design Shark, # http://www.designshark.com/ # Quick Contact: http://www.designshark.com/messaging.ihtml # Tel: 905-684-2952 ##########################################################

« previous php.general (#42807) next »