mhoctober Posted March 18, 2006 Share Posted March 18, 2006 All..I'd like a .htm page to contain php script that can detect the file name of the current loaded page....eg if a user clicks a link that loads the following page ...www.myhost.com/12345.htmI'd like 12345.htm to contain code that is able to extract the /12345.htm for storeage in a table or echo to the screen etc.... I have been playing around with <?php$url1=$_SERVER['REQUEST_URI'];echo $url1;?>which works fine but when I attempt to encapsulate this in html and save and then load it as a .htm file the only output I get is "This is a test file"<html><body>This is a test file<?php$url1=$_SERVER['REQUEST_URI'];echo $url1;?></body></html>Am I missing something simple!!!?? Quote Link to comment https://forums.phpfreaks.com/topic/5247-detecting-the-file-name-of-the-currently-loaded-page/ Share on other sites More sharing options...
hitman6003 Posted March 18, 2006 Share Posted March 18, 2006 Make sure that .htm is set as a php extension for IIS or Apache, depending on what your using. Normally .php is set as a php script, and the other extensions will be treated as ordinary html (.htm, .html). Other exetention that can be set include .cfm for coldfusion, .asp for asp, and so on and so forth.Basically it's in the configuration of your server. Quote Link to comment https://forums.phpfreaks.com/topic/5247-detecting-the-file-name-of-the-currently-loaded-page/#findComment-18641 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.