Jump to content

All files in directory switch


konetch

Recommended Posts

I have this so far

<?php
$dir = str_replace('/', '', __DIR__);
switch($dir)
{
case 'travel':
echo '<div id="top">';
break;
case 'sports':
echo '<div id="top1">';
break;
case 'politics;':
echo '<div id="top2">';
break;
case 'submit':
echo '<div id="top3">';
break;
case 'links':
echo '<div id="top3">';
break;
case 'column':
echo '<div id="top3">';
break;
case 'funny':
echo '<div id="top3">';
break;
default:
echo '<div>';
}
?>

 

I want all the files in the directory shown in the case what I have. I want all files in the directory 'travel' to have '<div id="top">' appear in the source code of all files within the directory 'travel'. This doesn't work though. Does anybody have any idea how to fix this?

Link to comment
https://forums.phpfreaks.com/topic/153370-all-files-in-directory-switch/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.