Time Stamp a Page

Using Dreamweaver (yeah, a no-no here) :stuck_out_tongue_closed_eyes: I was able to add a time stamp to each page that would update on “save”.

For example: at some point on my page this would show up; “Last Updated: Wednesday, March 10, 2021 6:38 AM”

I don’t see any bootstrap code for this? Does anyone know of a way to accomplish this in Blocs?

Thank you

Rich

Hello @WeatherguyNH there is the solution:

1st - Edit your .htaccess file and in the end add the following code:

AddType application/x-httpd-lsphp .htm .html

And you ask why? Because in this way you can export an html in Blocs and tell Apache to read html to find php code as well and run it…

2nd - In any place you want the information just add a Code bric and insert this code:

<?php $filename = './index.html';
	if (file_exists($filename)) {
    	echo "Last updated: " . date ("F d Y H:i:s.", filemtime($filename));
	}
?>

Note: In this case I use ./index.html as I’m inserting this in the page index.html, for example if you want to add the stamp in the page contacts.html so you just change the code to ./contacts.html

And there you go:

you can check here in the footer on the 4rd column.

And you can edit font and style adding a class to this code and change it as you like.

Hope it helps you…

1 Like

Pealco:

This is extremely helpful. Thank you for the posting and explanation.
Since I am not a web programmer, perhaps you could say bit more about .htaccess file?
Where do I find it, etc…

Once again, thank you VERY much…

Rich

Hello @WeatherguyNH,

Sorry, you’r right.

So normally htaccess is a file you can find in the hosting, if you gave CPANEL you can go to File Manager -> public_html and select the option to show “Hidden Files” and you will find a file htaccess previewed with a dot, so like this: .htaccess

In linux probably you will find it in: /var/www/html

So normally is in the root where you have the files for the website.

So if you load your content by FTP you can see it if you enable the “Show hidden files” option.

If you are in linux, you have to enter in the folder where is the file, using terminal and use command “cd” and the name of consequent folders until you are in the same folder as the webpage, then you can use the command “nano .htaccess”.

If you use FTP just right click in the file and select open with “any code application you have or the text editor”

If you use windows, just right click and open file with text editor.

If for some reason you don’t find any .htacess file you can create one.

In linux when you use the command nano and there is nothing inside then in the end it will ask if you want to save the file, you say yes and it will create it automattically.

In XAMPP or Windows or whatever you just create a txt file, give it the name .htaccess and remove there termination (.txt).

Hope it guide you in the correct way…

Very helpful once again…

Thank you, I appreciate the time you took.

Rich