Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> System szablonow (klasy)
-Gość_bim-
post
Post #1





Goście







Pisze system szablonow w klasie, i mm problemik. Nie za bardzo rozumiem jak napisac systethemow w klasie. Mialem kiedys na funkcjach ale to przestazale. Daje sobie jako tpl i w nim jest no
<table><tr><td>{top}</td></tr></table>
a klase mam:
  1. <?php
  2. class theme {
  3. var $top;
  4. function theme($top) {
  5. $this->top=$top;
  6. }
  7. function load() {
  8. global $theme, $folder, $adres, $nazwa;
  9.  
  10. $theme = file_get_contents( 'theme/default/default.tpl' );
  11.  $theme = ereg_replace( '{title}', $nazwa, $theme );
  12.  
  13. $theme = ereg_replace( '{lewe}', 'lewe', $theme );
  14. $theme = ereg_replace( '{top}', $this->top, $theme );
  15.  $theme = ereg_replace( '{prawe}', 'right', $theme );
  16.  $theme = ereg_replace( '{adres}', $adres, $theme );
  17. $theme = ereg_replace( '{folder}', $folder, $theme );
  18. //$theme= ereg_replace( '{blok_usera}', blok_user(), $theme );
  19. echo $theme;
  20.  
  21.  
  22. }
  23. }
  24. ?>
A wywoluje :
  1. <?
  2. if( !@include("config.php") )  
  3. die("<b>Brak pliku config.php</b>"); 
  4.  
  5.  
  6. $thm= new theme(top());
  7. $thm->load();
  8. function top() {
  9. global $link, $db, $config, $page, $prefix, $autorzy, $folder, $autorzy_ava, $zap, $adres, $folder, $mail, $REMOTE_ADDR;
  10.  
  11. if( !include('mody/'.$link[0].'.php') )  
  12. die("<b>Nie ma takiego modułu. Błąd!!!</b>"); 
  13. }
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. ?>
Help me (IMG:http://forum.php.pl/style_emoticons/default/sadsmiley02.gif)
Go to the top of the page
+Quote Post

Posty w temacie
- Gość_bim   System szablonow (klasy)   6.04.2006, 13:19:15
- - Gość_bim   a problem jest taki ze jak wywoalam $thm= ne...   6.04.2006, 13:30:39
- - AxZx   nie mozesz dac echo w funkcji bo wtedy bedzie wywa...   6.04.2006, 13:50:09
- - Gość_bim   nadal jest na gorze (wczesniej dalem return i zmie...   6.04.2006, 13:52:00
- - Guest   wiem co jest zle a nie wiem jak naprawic :/ [PHP] ...   6.04.2006, 14:45:08


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: 23.12.2025 - 18:06