Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [smarty] odświerzanie się
Forum PHP.pl > Forum > Przedszkole
Ruch Radzionków
witam mam problem otórz mam taki kod:
  1. <div id="srodek">
  2. {if ($stronadocelowa)}
  3. {include file="$stronadocelowa"}
  4. {/if}
  5. </div>

oraz 2 kod php:
  1. $str = $_GET['panel'];
  2. if($str == '')
  3. {
  4. include('page/news.php');
  5. $stronadocelowa = SZABLON_PELNA_SCIEZKA . 'news.tpl';
  6. $smarty->assign("stronadocelowa", SZABLON_PELNA_SCIEZKA . 'news.tpl');
  7. echo'1';
  8. }
  9. else
  10. {
  11. if(is_file('page/'.$str.'.php'))
  12. {
  13. include('page/'.$str.'.php');
  14. $stronadocelowa = SZABLON_PELNA_SCIEZKA . ''.$str.'.tpl';
  15. $smarty->assign("stronadocelowa", SZABLON_PELNA_SCIEZKA . ''.$str.'.tpl');
  16. }
  17. else
  18. {
  19. echo'2';
  20. include('page/news.php');
  21. $stronadocelowa = SZABLON_PELNA_SCIEZKA . 'news.tpl';
  22. $smarty->assign("stronadocelowa", SZABLON_PELNA_SCIEZKA . 'news.tpl');
  23. }
  24. }

i mam taki problem że jak zmienię stronę to w php zemienia się wszystko a na stronie w smartach nie jest dalej ta sama strona co była co musze zrobić żeby się automatycznie odświeżała ?
i jeszcze pokazuje mi się strona :
Kod
Smarty Debug Console - Total Time 0.02711
included templates & config files (load time in seconds)
theme\mit2\header.tpl (compile 0.00000) (render 0.00000) (cache 0.00067)
theme\mit2\left.tpl (compile 0.00000) (render 0.00000) (cache 0.00087)
theme\mit2\center.tpl (compile 0.00000) (render 0.00000) (cache 0.00075)
theme\mit2\footer.tpl (compile 0.00000) (render 0.00000) (cache 0.00065)
assigned template variables
$SCRIPT_NAME    Smarty_Variable Object (3)
->value = "/skill/panelsmarty/index.php"
->nocache = false
->scope = "Global"
$sesja    Smarty_Variable Object (3)
->value = "zle"
->nocache = false
->scope = "Smarty root"
$stronadocelowa    Smarty_Variable Object (3)
->value = "theme/mit2/news.tpl"
->nocache = false
->scope = "Smarty root"
$title    Smarty_Variable Object (3)
->value = "strona by mit2"
->nocache = false
->scope = "Smarty root"
$zliczhelp    Smarty_Variable Object (3)
->value = 0
->nocache = false
->scope = "Smarty root"
assigned config file variables (outer template scope)
nospor
Moze najzwyklej w swiecie o ten warunek:
if(is_file('page/'.$str.'.php'))
nie jest spelniony i zawsze wyswietlasz stronę news....
Ruch Radzionków
użyłem file_exists i jest tak samo. w php jeszcze dodałem echo "1" 2 i 3 które pokazuje mi co jest wybrane i z strony php pokazuje dobrze tylko że strona się nie zmienia
nospor
W kodzie widzę tylko ECHO dla news. Nigdzie nie widzę byś miał echo w IF który ci pokazałem.
Ruch Radzionków
dodałem w:
  1. if(is_file('page/'.$str.'.php'))
  2. {
  3. echo'3';
  4. include('page/'.$str.'.php');
  5. $stronadocelowa = SZABLON_PELNA_SCIEZKA . ''.$str.'.tpl';
  6. $smarty->assign("stronadocelowa", SZABLON_PELNA_SCIEZKA . ''.$str.'.tpl');
  7. }
nospor
To jesszcze dla pewności zapytam: wyświetla ci sie to 3?

Bo z debugu jaki pokazałeś widać jak wół:
$stronadocelowa Smarty_Variable Object (3)
->value = "theme/mit2/news.tpl"
że ciągle masz wartość news ustawioną smile.gif
Ruch Radzionków
pokazuje mi 3
i teraz pokazuje:

Kod
$SCRIPT_NAME    Smarty_Variable Object (3)
->value = "/skill/panelsmarty/index.php"
->nocache = false
->scope = "Global"
$sesja    Smarty_Variable Object (3)
->value = "zle"
->nocache = false
->scope = "Smarty root"
$stronadocelowa    Smarty_Variable Object (3)
->value = "theme/mit2/login.tpl"
->nocache = false
->scope = "Smarty root"
$title    Smarty_Variable Object (3)
->value = "strona by mit2"
->nocache = false
->scope = "Smarty root"
$zliczhelp    Smarty_Variable Object (3)
->value = 0
->nocache = false
->scope = "Smarty root"
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.