I was asked how to add an automatic new year for a site copyright in one of my Source Projects.
The answer is pretty easy, but the topic is a little more complex.
To add the year to a page automatically every year:
- Make sure you are using php pages with .php on the end of the filemane instead of .html.
© <?php echo date("Y"); ?> into a default Coder (set to HTML), ideally in the bottom of your footer.
3. Add the Utillity Class stack if you want to set the colour and set
txt-1 to be the colour you want and then add
txt-1 to the Coder class. Add
u-align-center to the Coder class if you want the date to be centred.
Note this will work in RW Preview.
It has become common practice to create and add a copyright year for every new year on the assumption that there will be some form of implied protection of content and that the site was recently updated in the copyright year.
Technically, a copyright starts from the year that is displayed, so if you update that displayed year, every year, you are cancelling any web claim to copyright AFAIK.
A better way to achieve more accuracy from a copyright statement is I think, to include a date range such as
2001 - 2022. This adds a bit more credibility and corectness and also achieves the main aim of showing that the site is not dormant.
So to do this, in point
2 above, use
© 2001 - <?php echo date("Y"); ?> and adjust the starting year for your site.
Also wanting with a script, also useful in markdown:
#####Copyright © 2001<script>new Date().getFullYear()>2001&&document.write("-"+new Date().getFullYear());</script> COMPANY-NAME
You can also use the RW macro function to generate the publish date of the RW project file, as a last published date
%last_published%. This can be worth doing if you do update regularly. Note - this works in Preview.
NOTE This macro above is a RW macro and is not dependent on any other stack (doesn’t even need Stacks) and it creates a fixed date to display when the RW file owner last pressed Publish. This displayed date will not change until the next time that the RW project file is next published. It will NOT change when any CMS or blog updates are made to the site, unless a RW publish is involved.
The example below uses the following in a Paragraph stack.
© 2001-<?php echo date("Y"); ?> | Last updated %last_published%
What is displayed is the current year, i.e. 2022 and this will automatically update to display the current year at the beginning of that year. I.e. on Jan 1 2023, the year displayed will become 202, without any intervention from the site owner. The last published date shown is just the date that RW project file was last published and will remain at that date until the next RW publish.
Just for completeness, there is also this one free:
Se usate Poster di @Jannis ricordate di inserire “PHP Enabler Stack”
If you use Poster by @Jannis remember to insert “PHP Enabler Stack”
Here, on a page with Poster2:
Otherwise from this error:
“Parse error: syntax error, unexpected '”’, expecting ‘-’ or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /private/var/folders/1t/hlqyrrts1qj3x6b4fr6m61380000gn/T/com.realmacsoftware.rapidweaver8/RapidWeaver/9253/document-0x134efbf40/RWDocumentPagePreview/blog/index.php on line 1200"
Why would you add this last updated information inside a poster item / blog post?
You have the created date per poster item therefore.
You are right, but this helps, it is useful, I use it to notify that there have been updates, new posts or changes to the Diary page. (even small changes, for example inserting new photos in old posts, restyling pages) … it works very well.
At each update you are warned (via a stored cookie), which displays a stack to be inserted, I use markdown.
But inserting the stack LU, not inside Poster, even outside, but on the same page, generates the error I wrote above.
Just to be clear, the short code I mentioned in Posts 1 and 3 does not require any additional code or stacks. Having any other stack on a page will not change this so if you have Poster on a page you will not need anything else. I am a bit confused with your recent posts, but I think you are talking about something very different, which is to display when a CMS or blog was last updated.
This thread is about displaying an automatic year display and the date that a RW file was last published.
That’s right, the code you mentioned in posts 1 and 3 are for copyright and last update date, they work perfectly and don’t need add-on stacks.
What I wrote in my posts is just an addition, example:
- if someone doesn’t have Linux Hosting, so he can’t use PHP from post1, he can use the script from post2 instead;
- the LU stack, I have reported it just for completeness, since it is free. I have verified that it works very well and is more accurate than
%last_published%, more correct to say that it "better understands the updates made more precisely the date and time of the last RW publication, and if it is necessary to report them … in the case of a css or, on the other hand, a text or an image. In this case the stack is able to display a warning to the user (by inserting a stack of your choice), by means of a cookie switch that stores the date-time of the latest update / publication.
At least that’s what I tested, a complete solution I think. However, in case someone wants to test this stack on a page that includes Poster2, they must insert it in the “PHP Enabler Stack” to avoid generating the error.
Rightly as you said, if someone doesn’t want to install additional stacks, your shortcodes are absolutely perfect.
Sorry, that’s not detailed enough. You only need this PHP Enabler Stack when inside a Poster Item. And I doubt anyone needs some kind of last updated date inside a Poster item / blog post.
Excellent consideration 👍
Although INAL, in the interest of legal accuracy, this is all performance theater: the US does not offer or accept copyrights on websites per se, although some individual parts may be eligible for protection.
This thread is really about implementation of an automatic date andalso about displaying the date of the last RW publish.
I suspect that the vast majority of RW users are not interested in the legal side of copyright law but want to show that their site has been updated “recently”.
Also a recent date avoids the potential visitor missconception that if a site displays for example,
Copyright 2017, that the site has been dormant for 5 years.
The copyright message may deter casual stealing of content but anyone concerned about copyright should seek legal guidance.
Thanks for your comments. Since I’ve been developing websites for 25 years now, all of that occurred to me. That was why I used it for years, until I realized that in today’s litigious society, inadvertently claiming a copyright on someone else’s work (by claiming copyright on the whole site) isn’t the most wise thing to do. What people do is no concern of mine, but since copyright is a legal claim, one simply ought to know the actual law.
These days, my footers simply say “Name 2022” and leave off the copyright. That achieves the “marketing purpose” by appending a date.
Not trying to start a fire here. Simply explaining that copyright isn’t what most people think it is. Use with care.
I totally agree. Not worth the pixels they are displayed on.