[PHP] extracting a html file name

2002-04-23 Thread php

Hello,


Anybody have any suggestions on how i could get the test.html from the following:



http://www.mydomain.com/member.php/randy/test.html



Here is the part that I am having trouble with:


the randy is not a directory it is a member name so it can change

ie bill,  car, jack, moneypower   etc...

example

http://www.mydomain.com/member.php/moneypower/test.html


I have experimented with the php variables that come in , but the only way I could 
figure out to get test.html out of there is If I captured the $PATH_INFO AND did a 
str_replace  on all the html filenames on that site and did another one to get rid of 
the /  .  then I would have the member name and then i could do a string replace on 
the member name from the path info, which works , for now but as I get more files etc, 
it's gonna be a pain in the butt,  there has to be a better way to do it.

Any suggestions?


Randy 






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] extracting a html file name

2002-04-23 Thread Matt Williams

On Tuesday 23 April 2002 6:59 pm, [EMAIL PROTECTED] wrote:

 ie bill,  car, jack, moneypower   etc...

 example

 http://www.mydomain.com/member.php/moneypower/test.html


 I have experimented with the php variables that come in , but the only way
 I could figure out to get test.html out of there is If I captured the
 $PATH_INFO AND did a str_replace  on all the html filenames on that site
 and did another one to get rid of the /  .  then I would have the member
 name and then i could do a string replace on the member name from the path
 info, which works , for now but as I get more files etc, it's gonna be a
 pain in the butt,  there has to be a better way to do it.

Hi the function you need is explode.

try

$my_path = explode(/,$PATH_INFO);
array_shift($my_path);

so $my_path[0] will be moneypower using the above
$my_path[1] will be test.html

HTH

matt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] extracting a html file name

2002-04-23 Thread Randy Johnson

Matt,

Thanks  That worked perfectly!   I cannot believe I did not think of
explode, i have used it before :-)

Thanks again,

Randy
- Original Message -
From: Matt Williams [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Dave Sugar [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, April 23, 2002 10:02 AM
Subject: Re: [PHP] extracting a html file name


 On Tuesday 23 April 2002 6:59 pm, [EMAIL PROTECTED] wrote:

  ie bill, car, jack, moneypower etc...
 
  example
 
  http://www.mydomain.com/member.php/moneypower/test.html
 
 
  I have experimented with the php variables that come in , but the only
way
  I could figure out to get test.html out of there is If I captured the
  $PATH_INFO AND did a str_replace on all the html filenames on that site
  and did another one to get rid of the / . then I would have the member
  name and then i could do a string replace on the member name from the
path
  info, which works , for now but as I get more files etc, it's gonna be a
  pain in the butt, there has to be a better way to do it.

 Hi the function you need is explode.

 try

 $my_path = explode(/,$PATH_INFO);
 array_shift($my_path);

 so $my_path[0] will be moneypower using the above
 $my_path[1] will be test.html

 HTH

 matt

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php