How to use dynamic text in an html/htm page

Whether you have a Joomla, WordPress, or E-commerce website, updating the copyright year on your website may not be a legal requirement, but it’s a smart marketing method to prove that your business is active. Showing the year is especially important if you have a site without dates on its content.

There’re many ways you can automatically refresh the copyright year by inserting a simple JavaScript or php script (see below) into your website’s html code, or you can manually change the year in the footer of your website, or you can use direct PHP codes such as echo date(‘Y’) in the footer.
Here’s the JavaScript. Copy and paste it wherever you want the current year to appear:

<script language="javascript" type="text/javascript" >
var today = new Date()
var year = today.getFullYear()
document.write(year)
</script>

And here’s the php script:

<?php echo date("Y"); ?>

The php code is simpler, but it may not work yet. You need to take another step first to make the php script run on html pages. Create or edit an .htaccess file. in the root of your website directory. Open a new file in a text editor like Notepad or Notepad++. Paste the following code into the file:

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

If you have an existing .htaccess file, open it and add the above code. The .htaccess file now affects every other file in your website.