title: php simple str_replace template date format
body: <p>i am trying to make a simple template system for a website news module. here are my codes.</p>
  
  <pre><code>$temp = "#title#, &lt;br&gt;#date(d-m-Y)#&lt;br&gt; #story#";
  $data = array(title=&gt;"this is a title", date=&gt;1350498600, story=&gt;"some news story.");
  </code></pre>
  
  <p>i have found this simple class on stackoverflow and tried to use it for my purpos.</p>
  
  <pre><code>class EmailTemplate
  {
       private $_template = '';
  
      public function __construct($template)
      {
          $this-&gt;_template = $template;
      }
  
      public function __set($key,$value)
      {
          $this-&gt;_template = str_replace("#" . $key . "#",$value,$this-&gt;_template);
      }
  
      public function __toString()
      {
          return $this-&gt;_template;
      }
  } 
  </code></pre>
  
  <p>i use it like :</p>
  
  <pre><code>    $Template = new EmailTemplate($temp);
      $Template-&gt;title = $data['title'];
      $Template-&gt;date = $data['date'];
      $Template-&gt;story = $data['story'];
      echo $Template;
  </code></pre>
  
  <p>all works fine for title and story but as it comes to date i have problem because i want to format date as defined in template i.e. date(d-m-Y). How can i do that ?? </p>
  
  <p>The template is coming from different table and news is coming from different table. and date format is going to be defined in template.</p>