Re: URL Parsing...

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

 



Amanda Loucks wrote:
> Hi,
> 
> I'm working on redesigning the backend of the website for work.  It was
> originally done in ColdFusion, but I'm switching it over to PHP - probably
> going to transfer the website from where it's currently hosted to something
> a lot cheaper, too, hence the switching to PHP.  Anyway.
> 
> Because we are a manufacturing company, we have a few different lines of
> products.  Currently, each different product line has it's own page (and own
> meta tags).  The current set up has ColdFusion grabbing the current page
> from the URL stripping off the '.cfm' extension and adding '-meta.cfm'
> before including it in the header.
> 
> I'm sure there is a way to do this in PHP, but I'm out of shape enough with
> using PHP that I can't remember, and I can't seem to find anything that will
> work for me.  I just want to be able to pull whatever address is in the URL,
> get the file name, and go from there.
> 
> Any ideas?

one of these should give you something to go on:

echo preg_replace('\.cfm$', '-meta.cfm', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), "\n";
echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']), "\n";
echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['SCRIPT_FILENAME']), "\n";

> 
> Anything would be helpful.  :)
> 
> Thanks,
> Amanda
> 

-- 
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