I created a new function (getBirthday) in my file CatalogoArtisti.php to calculate age, depending on your birthday, I would like to hook this function in my template but i do not know how to do.
To be more clear in my template I have the birthday ($DateBirthDay) then I would pass this data to the function (getBirthday) to display in the template the calculation of the age.
==== Silverstripe version 2.4 ====
CatalogoArtisti.php
...........
getBirthday function ($birthday)
{
$ datetime1 = new DateTime ($ birthday);
$ datetime2 = new DateTime (date ('Y-m-d'));
$ diff = $ datetime1-> diff ($ datetime2);
return $ diff-> format ('% y');
CatalogoArtisti.ss
.............
<% Control Artista_Album%> <p> class = "arialBold"> $DateBirthDay </ p>
/ / I need the age?
<% End_control%>
Thank you all in advance for the help that you will give me
Have a nice day
MG