Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Klasa Template, Potrzebowałem i napisałem, ale...
Turgon
post
Post #1





Grupa: Zarejestrowani
Postów: 800
Pomógł: 0
Dołączył: 26.11.2005
Skąd: Nowy Sącz

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


Jest problem. Nie umiem sobie napisać Debuggera.
To klasa :
  1. <?php
  2. class liteTemplate
  3. {
  4. var $tmpl;
  5. var $tag;
  6.  
  7. function liteTemplate ($name)
  8. {
  9. $this->tmpl = implode('', file($name));
  10. $this->dane = Array();
  11. }
  12.  
  13. function add_tag($name, $value = '')
  14. {
  15. if (is_array($name)) {
  16. $this->dane = array_merge($this->tag, $name);
  17. } else if (!empty($value)) {
  18. $this->tag[$name] = $value;
  19. }
  20. }
  21.  
  22. function execute() {
  23. return preg_replace('/{([^}]+)}/e', '$this->tag["\\1"]',
  24. $this->tmpl);
  25. }
  26.  
  27. }
  28. ?>
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: 24.09.2025 - 23:33