Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> tpl -> podmiana styli, problem
Daimos
post
Post #1





Grupa: Zarejestrowani
Postów: 1 319
Pomógł: 118
Dołączył: 26.11.2003
Skąd: Lublin

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


witam, mam taka klase:
  1. <?php
  2.  
  3. class Template {
  4.  
  5. var $strTemplateDir = './templates/testowy';
  6. var $strBeginTag = '{';
  7. var $strEndTag = '}';
  8. var $arrVars = array();
  9. var $arrValues  = array();
  10.  
  11. function assign( $strVar, $strValue ) {
  12. $this->arrVars[]  = $this->strBeginTag . $strVar . $this->strEndTag;
  13. $this->arrValues[] = $strValue;
  14. }
  15.  
  16. function display( $strFile ) {
  17. $resFile = fopen( $this->strTemplateDir . '/' . $strFile, 'r' );
  18. $strBuff = fread( $resFile, filesize( $this->strTemplateDir . '/' . $strFile ) );
  19. $strTest = str_replace( $this->arrVars, $this->arrValues, $strBuff );
  20. echo $strTest;
  21. }
  22. }
  23. ?>


wszystko dziala ok, ale chce zrobic mozliwosc podmiany templetow, i jak zrobie cos takiego:
  1. <?php
  2.  
  3. $wybranystyl = &#092;"testowy\";
  4. class Template {
  5.  
  6. var $strTemplateDir = './templates/'.$wybranystyl; // tu jest cos nie tak
  7. var $strBeginTag = '{';
  8. var $strEndTag = '}';
  9. var $arrVars = array();
  10. var $arrValues  = array();
  11.  
  12. function assign( $strVar, $strValue ) {
  13. $this->arrVars[]  = $this->strBeginTag . $strVar . $this->strEndTag;
  14. $this->arrValues[] = $strValue;
  15. }
  16.  
  17. function display( $strFile ) {
  18. $resFile = fopen( $this->strTemplateDir . '/' . $strFile, 'r' );
  19. $strBuff = fread( $resFile, filesize( $this->strTemplateDir . '/' . $strFile ) );
  20. $strTest = str_replace( $this->arrVars, $this->arrValues, $strBuff );
  21. echo $strTest;
  22. }
  23. }
  24. ?>

to wywala bledy :/


--------------------
scriptun.com. Startup z poradnikami do gier ttp.zone i ttpzone.pl
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 19.08.2025 - 20:22