Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.