PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
I am a dbase programmer - at least I was 15 years ago when I got burned out. This is my first serious look at reestablishing my programming skills, although I have done some HTML progrmming over the years, it left quite a bit to be desired. I am a firm believer in subroutines, something HTML couldn't fully accomplish. I have about 30 pages on the website I am developing and don't want to have to maintain 30 fully coded pages.
Are there any major problems with the concept of the following code? (I substituted [] for <>)
<? php
include(header.php)
$bodytext = 0; //This actually gets its value from the header in the mapped areas so I will delete this from the real code
switch ($bodytext) {
case "1" :
include(aboutus.php);
break;
case "2" :
include(contactus.php);
break;
default :
include(index.php);
break;
}
include(footer.php)
?>
Thanks in advance,
Steve
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
No, except if you take off the "" around the case statements it will be evaluated as an integer instead of a string, meaning on a low level point of view it will be executed quicker