Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Re: How to send parameters from template to a function in PHP

$
0
0

Hi Maga,

Try moving the getBirthday function to the class that your <% Control Artista_Album %> is looping through. In that class modify the getBirthday function like so.

getBirthday function ()
{
$birthday = $this->DateBirthDay; //assuming that DateBirthDay is a db field
$ datetime1 = new DateTime ($ birthday);
$ datetime2 = new DateTime (date ('Y-m-d'));
$ diff = $ datetime1-> diff ($ datetime2);

return $ diff-> format ('% y');

}

Then in your <% Control Artista_Album %> block, just replace $DateBirthDay with $Birthday

<% Control Artista_Album%>

<p> class = "arialBold"> $Birthday</ p>

<% End_control%>


Posted to: How to send parameters from template to a function in PHP | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles