Turning Part of URL to Variable<

liunx

Guest
I have a directory structure set up like this:

thehotweb.net/sites/Scripts/
thehotweb.net/sites/Scripts/PHP/
thehotweb.net/sites/Scripts/PHP/Another_Category

What I need to do is pull "Scripts" out and turn it into a variable. Any ideas on how this can be done? I know that php has an explode function but I can't figure out how it works.

Thanks,
Paulyeah with apache server
.htaccess file
and forcetype

<!-- m --><a class="postlink" href="http://www.devarticles.com/c/a/Apache/Using_ForceType_For_Nicer_Page_URLs/Originally">http://www.devarticles.com/c/a/Apache/U ... Originally</a><!-- m --> posted by illogique
yeah with apache server
.htaccess file
and forcetype

<!-- m --><a class="postlink" href="http://www.devarticles.com/c/a/Apache/Using_ForceType_For_Nicer_Page_URLs/">http://www.devarticles.com/c/a/Apache/U ... Page_URLs/</a><!-- m -->
No, I don't need to turn PHP pages into search engine friendly URLs. The URL is already in the format above, all I need to do is take "scripts" out and turn it into a variable so that I can do this:


$variable = function_to_get_scripts;

echo "You are browsing $variable";

Then when you access the scripts page you will see "You are browsing Scripts".

Thanks,
Paulsorry about that
(well the page 4 said something about what you want!)
something like

$vars = explode('/', $_SERVER['PHP_SELF']);
array_shift($vars); //to remove sites

now
$vars[0]=='Scripts'
$vars[1]=='PHP'
$vars[2]=='Another_Category'


i don,t know if it's best to use PHP_SELF or REQUEST_URII knew it would be that easy :). Thank you, it works great.
 
Top