Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Smarty probleem
Forum PHP.pl > Forum > Przedszkole
DR.GhostRider
Witam otóż mam klasę
  1. <?php
  2. Class Index extends  text{
  3.  
  4. Public $email;
  5. Public $temat;
  6. Public $tresc;
  7.  
  8. Public function Contact($email,$temat,$tresc){
  9. echo $this->text_contact($email,$temat,$tresc);
  10. }
  11.  
  12. Public function Home_page(){
  13. return $this->text_home_page();
  14.  
  15. }
  16.  
  17.  
  18. Public function Services(){
  19. return $this->text_services();
  20.  
  21. }
  22.  
  23. Public function About_us(){
  24. return $this->text_about_us();
  25.  
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32. }
  33.  
  34.  
  35. class text{
  36.  
  37. private function read_file($file){ //Metoda zwróci nam zawartość pliku
  38. $plik = implode('', file('./texts/'.$file));
  39. return nl2br($plik);
  40. }
  41.  
  42. Public function text_contact($email,$temat,$tresc){
  43. echo $this->read_file('text_contact.txt');
  44. echo $this->ContactForm($email,$temat,$tresc);
  45.  
  46. }
  47.  
  48. Public function text_home_page(){
  49. echo $this->read_file('text_home_page.txt');
  50. }
  51.  
  52. Public function text_services(){
  53. echo $this->read_file('text_services.txt');
  54. }
  55.  
  56. Public function text_about_us(){
  57. echo $this->read_file('text_about_us.txt');
  58. }
  59.  
  60. public function ContactForm($EMAIL,$TEMAT,$TRESC){
  61. echo 'formularz';
  62. }
  63.  
  64.  
  65. }
  66. ?>


i w pliku index.php
mam
  1. <?php
  2. switch($_GET['p']){
  3. case'contact':
  4. {  
  5. $smarty->assign('show_page',$index->Contact($_GET['email'],$_GET['temat'] ,$_GET['tresc']));
  6. }
  7. break;
  8.  
  9. case'services':
  10. {
  11. $smarty->assign('show_page' ,$index->Services());
  12. }
  13. break;
  14.  
  15. case'about_us':
  16. {
  17. $smarty->assign('show_page' , $index->About_us());
  18. }
  19. break;
  20.  
  21. default:
  22. {
  23. $smarty->assign('show_page' ,$index->Home_page());
  24. }
  25.        
  26. }
  27. ?>

i w index.tpl w odpowiednim miejscu mam {$show_page}


Ale wszytko wyświetla się na górze ;/
Prosiłbym o pomoc
zbig
Sprobuj twoje metody zmienic z
  1. <?php
  2. Public function text_about_us(){
  3. echo $this->read_file('text_about_us.txt');
  4. }
  5. ?>


na

  1. <?php
  2. Public function text_about_us(){
  3. return $this->read_file('text_about_us.txt');
  4. }
  5. ?>


Pozdrawiam
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.