Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Klasa, system styli
stroju
post
Post #1





Grupa: Zarejestrowani
Postów: 179
Pomógł: 2
Dołączył: 17.11.2005

Ostrzeżenie: (0%)
-----


mam taką klasę:
  1. <?php
  2. class temp
  3. {
  4.     var $file = '';
  5.    
  6.     function tpl_get_file($name)
  7.     {
  8.          global $config_ss, $root_path;
  9.          
  10.          $path = $root_path.'style/'.($config_ss['styl']).'/'.$name.'.html';
  11.          $this->file = file_get_contents($path);
  12.          return $this->file;
  13.     }
  14.    
  15.     function tpl_set_array($array)
  16.     {
  17.          foreach($array as $key => $war)
  18.          {
  19.               $this->files = str_replace('{'.$key.'}', $war, $this->file);
  20.          }
  21.          return $this->files;
  22.     }
  23.  
  24.  
  25.  
  26. }
  27. ?>


i kod który wyświetla mi plik:
  1. <?php
  2. $temp->tpl_get_file('show_profile');
  3.  
  4. echo $temp->tpl_set_array(array('STATUS' => 'dd',
  5. 'AVATAR' => 's'));
  6. ?>


i problem mam w tym że z tablicy $array w pliku podmieniana jest tylko ostatnia wartość, w tym wypadku 'AVATAR', choć jest tego więcej i tylko tę ostatnią zmienia...
w czym robię błąd??
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.09.2025 - 19:00