Re: Friendly URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard,

well a much simpler solution than my old one:

$this->uri = explode('/',basename($_SERVER['SCRIPT_NAME']).$_SERVER['PATH_INFO']);

Many thanks for your help,
Bruno B B Magalhaes

On Dec 10, 2004, at 11:57 PM, Richard Lynch wrote:
$_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_FILENAME'] or ...

It's all in there, though you might have to tear it apart a bit to get
exactly what you want.


Bruno B B Magalhães wrote:
Hi Richard,

well but I want also the file it self to be included in it...

Regards,
Bruno B B Magalhaes

But I need
On Dec 10, 2004, at 8:20 PM, Richard Lynch wrote:

Bruno B B Magalhães wrote:
Hi guys,

As part of my framework I have a URI decoder so it explode, remove
unnecessary data (as GET query) amd put it into an array...

Is there any better way of doing this (faster?), just wondering.

		if(isset($_SERVER['REQUEST_URI']) === true)
		{
			$path = explode('/',$_SERVER['SCRIPT_NAME']);

			$total_paths = count($path);

			$path = stristr($_SERVER['REQUEST_URI'],$path[$total_paths-1]);

			$path = explode('/',$path);

			$total_paths = count($path);

			$i = 0;

			for($i=0;$i<$total_paths;$i++)
			{
				$get_string = false;

				$get_string = stristr($path[$i],'?');

if($get_string)
{
$get_string = "\\".$get_string;
$this->uri[$i] >>
strtolower(addslashes(strip_tags(eregi_replace($get_string,'',$path[ $i
])
)));
}
else
{
$this->uri[$i] = strtolower(addslashes(strip_tags($path[$i])));
}
}
}

I could be wrong, but I think you've just re-written the code that is already in PHP to give you $_SERVER['PATH_INFO']

<?php echo $_SERVER['PATH_INFO']?>

--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux