I have a query and while loop that can be modified to display a variety of tables (e.g. Birds, Mammals, Flowers, etc.). However, each table requires special styling, so the page is getting bloated with code, like this...

Code:
switch($MyURL)
{
 case 'State_Birds':
  // INNER SWITCH(es)
  switch($Symbol)
  {
   case 'bobwhite':
   case 'turkey':
   $Desig = '<span style="padding: 2px; background: #900; color: #fff;"><sup>G</sup></span>';
   break;
   case 'peregrine falcon':
   $Desig = '<span style="padding: 2px; background: #f00; color: #fff;"><sup>R</sup></span>';
   break;
   case 'wood duck':
   $Desig = '<span style="padding: 2px; background: #00f; color: #fff;"><sup>W</sup></span>';
   break;
   case 'Kirtland’s warbler':
   $Desig = '<span style="padding: 2px; background: #f66;"><sup>B</sup></span>';
   break;
   case 'mourning dove':
   $Desig = '<span style="padding: 2px; background: #0ff;"><sup>S</sup></span>';
   break;
   default:
   $Desig = '';
   break;
  }
So I deleted all the code inside the while loop, pasted it in a separate file, then included it...

Code:
require($BaseINC."/2B/inc/D/Content/Child/DB/RefGS/PlanimalsCode.php");
But it doesn't work - the code, that is. If I insert echo 'Hello World'; on the included file, that works.

Can anyone tell me how to include a file inside a while loop?

Thanks.