...

View Full Version : url category type variables



JayStang
08-22-2006, 03:31 PM
Hey guys,

I know i've scene this before but i was wondering how it was done. Say you had a url like..

somewhere.com/index.php/About/Services

The "About" and the "Services" are actually url variables, but passed that way instead of...

somwhere.com/index.php?variable1=About&variable2=Services

So in the first example it would be predefined that the first set of slashes holds "variable1" and the second set holds "variable2" and i would be able to reference them anywhere just as i would a normal url variable.

Any advice would be great. I'd really like to figure out how this is done.

Thanks

firepages
08-22-2006, 04:10 PM
Some use Apache's ModRewrite , others note that the server variable $_SERVER['PATH_INFO'] will hold `/About/Services`

so with
<?$bits=explode('/',$_SERVER['PATH_INFO']);?>
$bits will be an array 0=>'',1=>About,2=>Services

These days I use the PATH INFO route but note that it does have several drawbacks, ModRewrite is probably easier assuming your Apache installation has the module available.

JayStang
08-22-2006, 04:16 PM
great... thank you i'll look into both options.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum