Copyright

The ModX CMS provides a great plugin called Ditto. Ditto allows a web designer to quickly summarize web pages (documents) and display the summarizations in customized formats such as in a Blog, an RSS feed or even a sitemap. But how do you correct the copyright year of the RSS?

While creating this website in the ModX CMS, we decided to implement an RSS feed for this Blog and discovered that we could implement it quickly and correctly with the Ditto plugin that was bundled with the installation of ModX.

I setup the call to Ditto as follows:

[ [Ditto ? &parents=`2` &format=`rss` &display=`20` &total=`20` &removeChunk=`Comments`] ]

With the default installation, this worked quite nicely; but after reviewing the output, the copyright tag was displaying the wrong year–2006.

After some hunting through the code, I determined that there are two ways to fix the problem.

Method 1 (Correct Copyright Year)

The internal code for Ditto attempts to use the PHP variable called copyright. If this variable does not exist, it will default the copyright year to 2006. What a user can do is create a new Snippet that creates a copyright variable and sets it to a year then calls Ditto.

Method 2

(Correct Copyright Year)

This method will allow for the copyright year to always remain up to date but it depends on the site’s language. What you will need to do is find the language file that your site uses and change it there. For example, if your site uses English, you will be looking for the english.inc.php file in [install_location]/assets/snippets/ditto/lang/. For this file, on line 42, you will find the following line: $_lang[‘default_copyright’] = “Web Design | Website Development 2006”; For our installation, I changed it to the following: $_lang[‘default_copyright’] = “Web Design | Website Development “.date(“Y”,time()); This will return the server’s year portion as YYYY.

I originally left this as a solution on devcomments.com but I feel that additional clarity will help improve this situation.