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 YOTI,
thanks for your help but I tried to follow your directions but the template / html do not return any data?

For additional information:

The template catalogoartisti.ss is based on catalogoartisti.php,
into album.php there is the relationship with artista.php and i use the <% control Artista_Album%> to retrieve the field DataNascita (BirthDay)

The function that you suggested I inserted it in catalogoartisti.php and then I called from template catalogoartisti.ss

Artista.php
.....
class Artista extends DataObject {
   public static $db = array(
      
      "DataNascita" => "Date", //BirthDay
      
   );

Album. php
......
class Album extends DataObject {
   
   public static $has_one = array(
   "Artista_Album" => "Artista"   
   );

catalogoartisti.php
.....

public function getBirthday()
      {
         $birthday = $this->DataNascita; // DataNascita (BirthDay ) is a db field
         $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">$Birthday - sss </p>
                                             
                                             
Definitely something wrong I am a novice in programming.
I look forward to your help
thanks
greetings
MG


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