Cannot use PHP in Template -- Intended behavior?

  • I have installed a custom theme, in this case, Lucent, and made changes to the footer...


    Diff: LuzFaltexCopyright.tpl
    +<address class="copyright marginTop">
    +<a href="https://www.luzfaltex.com/" class="showDialogCopyright">Fall of the Citadel and its lore and assets © 2014-<?php echo date("Y"); ?> LuzFaltex, except where otherwise noted.</a>
    +</address>
    Diff: footer.tpl
    <div class="footerContent">
    {event name='footerContents'}
    {if ENABLE_BENCHMARK}{include file='benchmark'}{/if}
    {event name='copyright'}
    + {include file='LuzFaltexCopyright' application="wcf"}
    {include file='LucentCopyright' application="wcf"}
    </div>


    Of course, all changes were made through the ACP, not directly editing the files.


    Compiled HTML for the footer looks like this...


    HTML
    <div class="footerContent">
    <address class="copyright marginTop">...</address>
    <address class="copyright marginTop">
    <a href="https://www.luzfaltex.com/" class="showDialogCopyright">Fall of the Citadel and its lore and assets © 2014-<!--?php echo date("Y"); ?--> LuzFaltex, except where otherwise noted.</a>
    </address>
    <address class="copyright marginTop">...</address>
    </div>


    As seen, the second address line contains the contents of my footer, but the php code to get the 4-digit date is commented out. I would assume this is intended to help combat PHP injection...


    Is there a way to display a dynamic date in the footer without having to update it manually?

  • You cannot use PHP in templates. But you can use template modifiers. In your case, <!--?php echo date("Y"); ?--> would become: {'Y'|gmdate}