A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Web Development

Creating a Dynamic Copyright line in Joomla

Good post? Please, share it...
Pin It

Joomla CMS

Joomla CMS

Artisteer template designer

Artisteer template designer

In many Joomla templates, including those generated by Artisteer, there is a standard copyright notice, which one can set to something like © 2014 My Company Name. Mostly, this is not updated, automatically, so that, when 2015 comes around, you will have to manually change the copyright notice. It is usually quite un-customisable and I like to have this incorporated into a nice footer.

So, here’s a trick that I use, that will automatically update the copyright notice and allow it to be used as part of a more extensive footer:

I always use custom modules for my footers, at Position-27 (in Artisteer), so I get a ‘no worries about copyright year’ result, but I don’t have to edit the templates, to achieve this. Therefore, I can regenerate a new template and use it at any time, without having to customise it again.

Joomla Content Editor

Joomla Content Editor

For JCE users, the Super User profile must be set that PHP is allowed. Then you should edit the module as an SU. Otherwise, you have to use no editor, so raw PHP code will be accepted.

DirectPHP plug-in for Joomla

DirectPHP plug-in for Joomla

Now the excellent free plug-in DirectPHP should be installed, in order for PHP to work within Joomla content.

N.B. DirectPHP is very sensitive to the syntax you use for your PHP statements. For a date, you should use <?php echo date( “Y”); ?>, as you suggest. More modern OOP ways of doing this, like <?php echo (new DateTime)->format(“Y”); ?> will probably not work. I did some experiments.

e.g. the code for my company site looks like:
<p>All content is © 2009-<?php echo date( “Y”); ?><strong> Goaheadspace</strong> All rights reserved.</p>

It is part of a more extensive footer custom module, which is another advantage of this method. You can put whatever you want into your custom module and not have to accept the template’s formatting.

This may sound complicated, but, once you have done it, you can save the JCE settings and use them on any site.

Quickly install DirectPHP, load the JCE settings, create a custom module in position-27 and make the footer content, including <?php echo date( “Y”); ?> where appropriate. Then it all works – at least in my experience.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




This site uses Akismet to reduce spam. Learn how your comment data is processed.