Switch problem

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!

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Switch problem

Post by Sindarin »

I have created a dynamic footer for a client's page:

Code: Select all

<!--page inclusion-->   
<?php   
switch($_GET['page']){
  case 'contact':
      echo "";
  break;
  case 'products':
      echo "
<table width='781' height='121' border='0' align='center' cellpadding='0' cellspacing='0'>
  <tr>
    <td height='36' colspan='2' align='left' valign='top' class='style10a'></td>
  </tr>
  <tr>
    <td width='423' align='left' valign='top'></td>
    <td width='358' align='left' valign='top'>
<img src='images/index/enosi.jpg' alt='' width='347' height='85' /></td>
  </tr>
</table>";
  break;
  default:
      echo "<table width='781' height='121' border='0' align='center' cellpadding='0' cellspacing='0'>
  <tr>
    <td height='36' colspan='2' align='left' valign='top' class='style10a'></td>
  </tr>
  <tr>
    <td width='423' align='left' valign='top'></td>
    <td width='358' align='left' valign='top'>
<img src='images/index/enosi.jpg' alt='' width='347' height='85' /></td>
  </tr>
</table>";
}
include_once($include);
?>
I have created that way that in every page except contact the logo appears at the page footer. Problem is that they also want the logo out of the index page. Now, if I remove the code in the default section, it will be removed as well to all other pages, and I don't want to add other cases for each and every page.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Switch problem

Post by Zoxive »

I'm guessing $_GET['page'] is empty for the index page?

Code: Select all

case '':
// --------
break;
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: Switch problem

Post by Sindarin »

Yes, it's just index.php

Thanks, it works.
Post Reply