Let's say I have a folder called: "test" and inside this folder i have a file called "example.php" Now, the relative path to this file will be: "/test/example.php"
But, is there any way to create a relative path to all files inside a folder. So for example, I need to create a function that will apply to any file inside a specific folder, so instead of creating a list of relative path to every file in this folder. I could just create a single relative path that will point to a folder, and then the function will execute the action to every file inside this folder.
I've tried this: "/test/", I also tried this: "/test" but it doesnt work. Any suggestions will be highly appreciated.
Thanks.
EDIT: To be more specific, I need to create a link in the header that will be displayed differently depends of the current page. So if for example the current page will be home.php, or about.php the link in the header should be: "contacts" But if the current page will be shop.php, or staff.php the link in the header should be: "prices" . So, i created a php include file for the header, and inside i created an if/else statemet:
<?php if($currentpage==$type1) { ?>
<a href="http://example.com/contacts.php">contacts</a>
}else if (currentpage==$type2) { ?>
<a href="http://example.com/prices.php">prices</a>
<?php } ?>
Then, i put all the type1 pages inside the folder "type1", and all the type2 pages inside the "type2" folder. And then on every page file I added this code:
<?php
$currentpage = basename($_SERVER['SCRIPT_FILENAME']);
$type1="/type1/";
$type2="/type2/";
?>