HD-Date plugin for Joomla 4
Insert the current date or year at any point in your Joomla website.
what is this? | after installing | difference between javascript & php | how to style with css | older joomla 3 version
What is this?
HD-Date is a simple plugin that inserts the current date into your Joomla website. Just enter {date} at the point where you want the current date to be rendered or {year} for the current year. The plugin works within any content (including articles, modules, components or within any template HTML).
What to do after installing?
Install the zip file via the administration install manager as per any other plugin. Once it has installed go to the plugin manager, select HD-Date then enable the plugin. Use the plugin parameters to select whether to render the date/year with Javascript or PHP then click on Save when finished.
Then any instance of {date} or {year} on your site will be replaced with the current date () or year ().
What's the difference between the Javascript and PHP versions?
You can select whether to render the date/year using Javascript or PHP.
- There is more code involved in the Javascript version, but as it is a client side script the timing is more precise.
- There is less code involved in the PHP version but as it is a server side language the timing is less precise (eg. if the viewer is based in the UK but your server is based in the US then there could be six hours difference in the date).
We advise using Javascript for the date and PHP for the year (and these are the default settings).
How can I style the date with CSS?
For easy styling purposes the rendered date is wrapped in the class "hd-date". Therefore the following CSS code will render the date in bold red...
.hd-date {font-weight: bold; color: red;}
Does this work with Joomla 3?
You can download the older Joomla 3 version here.