morako
asked on
How do I create variables for each directory in a string?
I am trying to create variables for directories to be used later within the site as titles.
<?php echo $title_1 ?>
<?php echo $title_2 ?>
from /dir1/dir2/dir3
So far I am able to pick up the first title in the directory but having problems extracting the second or third titles... Below is where I am...
Any thoughts?
<?php echo $title_1 ?>
<?php echo $title_2 ?>
from /dir1/dir2/dir3
So far I am able to pick up the first title in the directory but having problems extracting the second or third titles... Below is where I am...
Any thoughts?
<?
if($location = substr(dirname($_SERVER['PHP_SELF']), 1))
$dirlist = explode('/', $location);
else
$dirlist = array();
$count = array_push($dirlist, basename($_SERVER['PHP_SELF']));
$address = 'http://'.$_SERVER['HTTP_HOST'];
for($i = 0; $i < $count; $i++)
($activepath .= str_replace("index.php","",'/'. $dirlist[$i]));
$value = $activepath;
$topdir = strtok($value, " / ");
$title_1 = ucwords($topdir);
$value2 = $activepath;
$secdir .= str_replace("/", "", " ", strtok($value2, " / ")) ;
$title_2 = ucwords($secdir);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER