The following line with the date and time is added using custom PHP code loaded by the Add Custom PHP plugin:

2024-10-12 12:31:18

 

Explanation

This demo works as described below:

a) This article contains the text #DATE#.

b) The custom code is replacing this text with the current date. Here is the code:

<?php
$body = JResponse::getBody();
$body = str_replace('#DATE#', date("Y-m-d h:i:s"), $body);
JResponse::setBody($body);
?>

This code is executed in every page of the demo. If the text #DATE# exists in that page then it is replaced by the date.

There are many ways a custom PHP code can be triggered in order to do something.