Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php,alt.comp.lang.php,alt.php Subject: Re: Newbie needs recommendation for fast learning a little php. Date: Wed, 30 Jun 2021 22:23:32 +0200 Lines: 53 Message-ID: References: <35nodg56nqinnfigtl6251fhlpkb42vb61@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net g62OcXeWx2VQrhp9Fl1yZgzJ4Zr4qwwJhthGI3M5W2oTl/s8XJ Cancel-Lock: sha1:076h6kZqUFItv7JMo8kTMzxhwlw= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: Content-Language: en-US-large Xref: csiph.com comp.lang.php:18699 alt.comp.lang.php:58 alt.php:3265 On 30/06/2021 19.49, Not_even_a_newbie@example.net wrote: > On Wed, 30 Jun 2021 16:24:38 +0200, "J.O. Aho" > wrote: > >> On 30/06/2021 14.08, Not_even_a_newbie@example.net wrote: >>> This does what I want, but only as a .PHP file. How do I get it into a >>> file named foo.html so I can have foo.html declare when it was last >>> modified? >>> >>> >> $file = $_SERVER["SCRIPT_NAME"]; >>> $break = Explode('/', $file); >>> $pfile = $break[count($break) - 1]; >>> //echo $pfile; >>> echo "This file was last modified on: " .date("Y-m-d >>> H:m",filemtime($pfile)); >>> ?> >>> >>> I feel as if I'm almost there. >> >> I won't comment on the code as Arno already done that, there is two >> options, I would say one option is not up to you, so in reality you have >> only one option (the last one) >> >> 1. Make the webserver to send .html files to tne php engine as it does >> with the .php files. >> >> 2. Rename the .html file to .php > > Uh oh. But I'm reading that I can embed php into a html file. Isn't > that possible? The issue is that the web server will not treat each file it handles as a php code, it will only look for files that ends with php, send those to a PHP-engine which parses the file and executes the php code and then hands back the output to the web server which then sends the output to the end user (the visitor to your web page). It's possible to allow .html/.htm files the same way, but then you need the administration rights of the server, as you are using a shared service, it means you don't have administrator privileges and those you can't do the change. So this leads to the only thing you can do, rename your files so that they are called .php instead of .html/.htm. If you don't want to rename files, then you need to look at javascript solution for displaying last modified document time. -- //Aho