Copyright
Permalink 1 user found helpful
I create the folders /blocks/content/templates (the top level /blocks folder will already exist) and in that create I file called 'replacements.php'. (it can be any name you want though)
Then I place in that file the following code:
<?php defined('C5_EXECUTE') or die("Access Denied."); $content = $controller->getContent(); print str_replace('{YEAR}', date('Y'), $content); ?>
Then on any Content block where I want it to automatically spit out the current date, I'll put in the text {YEAR} as a placeholder and then pick this custom template for the block via clicking on the block, selecting 'Custom Template' and picking the 'Replacements' template.
I like this approach as you can then put the dynamically changing year value anywhere you like in a normal content block.