-2

building on from this question here it turns out that i have to save the file as a *.php file to display the variable value.

Is there a way to achieve this by keeping the file as a .html? But still achieving the year being displayed in the browser?

here is the code:

    <?php
        $year = date("Y");
        echo "<p class='text-muted'>© $year. X Team</p>";

    ?>

So instead of haveing file.php with the above code I would have file.html with the above code but achieving the same thing.

Community
  • 1
  • 1
HattrickNZ
  • 4,373
  • 15
  • 54
  • 98

1 Answers1

1

Don't use php use Javascript.

<script language="JavaScript" type="text/javascript">
now = new Date
theYear=now.getYear()
if (theYear < 1900)
theYear=theYear+1900
document.write(theYear)
</script>

All html files should allow you to use java script.