...

View Full Version : how does "page.php/11/" work?



loonatik
01-26-2004, 05:32 PM
I came upon this page php website and this url:
http://www.outwardsound.com/bundles.php/
is sort of like a template. And if you add a number to the end like:
http://www.outwardsound.com/bundles.php/14/
you'll see valid product info.

I would've guessed to make a page, say bundles.php and to display valid info, it would be bundles.php?id=14
So how does this "bundles.php/14/" work? with the slashes (and without a variable like "?id="). Thanks.

coffeedemon
01-26-2004, 05:36 PM
he... i just fookin' asked that.

coffeedemon
01-26-2004, 05:50 PM
i figured it out.



<?php
function strip_ID($str)
{
$str = str_replace("/", "", $str);
return $str;
}

echo strip_ID($_SERVER["PATH_INFO"]); # a url HTTP://domain/dir/dir/filename/666/ returns /666/ so you have to strip the / out and replace it with nothing
?>


you can see the result at http://devleworm.com/window/phpinfo/64654654645654/

Nightfire
01-26-2004, 06:05 PM
Plenty of tutorials for mod_rewrite too, which is more effective I think

coffeedemon
01-26-2004, 06:07 PM
ah ha. yes it is. i figured it was something with the apache server. thanks a lot!

coffeedemon
01-26-2004, 06:16 PM
reference: http://www.sitepoint.com/article/910



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum