Updating the year in the footer of Templates

Hi Community!


Before I start going through over 100 BBIS Templates and update the year in the footer on each, just wanted to check to ensure that there is no code, snippet, tag, whatever....that is available in BBIS that I can add so that the year is automatically populated each year. I haven't found one, but maybe you have? If you have, would you please share?


Thanks so much!


Ruth Macfarlane

Compassion Canada

- Trying to avoid a tedious and time consuming task. :)

Comments

  • Chris Kastner
    Chris Kastner Blackbaud Employee
    Tenth Anniversary Kudos 1 Name Dropper Participant
    Assuming you're not referring to Email Templates (for which there is no way of doing a mass-update like this, or including any script)... there are two ways of achieving this for Page Templates depending on how your footer is put together:
    1. Using a Formatted Text and Images part, you can include merge fields for the date (via Insert > Merge Fields in the editor toolbar).  This provides you with three hardcoded options: "MM/DD/YYY", "Month DD, YYY", and just YYYY - so in your case you would likely just output the last one.

       
    2. Either in your Layout HTML code, or in an Unformatted Text or Formatted Text and Images part (pasted in via the Source Code view) - you can include a simple piece of JavaScript where you want the year to be rendered:

      <script>document.write(new Date().getFullYear())</script>
  • Thanks Chris Kastner‍. Unfortunately I am talking about the Email Templates. Should have been more specific in my original question. Guess I better get started on updating those templates. Thanks so much for taking the time to answer my question. Wish there was was one. Maybe one day. Sigh.


    Ruth
  • Chris Kastner
    Chris Kastner Blackbaud Employee
    Tenth Anniversary Kudos 1 Name Dropper Participant
    Ah - in that case... the only way of doing that would be to utilise SQL to find/replace the values in the dbo.EmailTemplate table which stores all of the email HTML in the ContentHTML field.  If you're self-hosted this would be relatively straight forward, but generally not something we would recommend or likely support... backing up the table first and doing a test in a non-live environment would give you a degree of confidence in this - but again this is not something I am specifically recommending.


    If doing this (against my recommendation) you would need to be very specific in what you are selecting - simply finding/replacing "2019" with "2020" for example would replace a range of things that may not actually be your footer.  You would want to select a good chunk of specific HTML that was consistent across all your templates and replace that with the updated version.


    Something along the lines of this code would get what you're after done pretty easily:

    UPDATE dbo.EmailTemplate
    set ContentHTML = cast(replace(cast(ContentHTML as nvarchar(max)),'<div id="footer-date">2019</div>','<div id="footer-date">2020</div>') as ntext)
    where ContentHTML like '%<div id="footer-date">2019</div>%'
    Alternatively to this - you could just remove the date from the footer so you don't need to worry about it each year.  I'm not sure there would be any legal requirement to actually include a current year if you're adding a copyright or similar to an email message (and indeed that's all inherently copyrighted anyway regardless of needing to specify it)
  • Thanks Chris.


    Yes, I can see that doing a replace of the values in the dbo might be easy....but I can also see that it would be "dangerous" and why you would not recommend it.


    I do keep pushing to just remove the year all together from the copyright line in the emails, but I continue to get push back that it is best practice to have the year in there. So....for now, I'll do them manually, while I continue throughout the year try to convince others that it is not necessary. I'm not convinced it's best practice......as it's about 50/50 when I look at the emails that I receive from other business or organizations. I would assume a best practice would have a higher percentage than just 50%. But, maybe that's just me.


    Thanks again Chris!