Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> funjkcjonalnosc kodu, bardziej wydajnie/funkjonalnie...
ernik
post
Post #1





Grupa: Zarejestrowani
Postów: 39
Pomógł: 0
Dołączył: 4.04.2005

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


mam plik index.php
  1. <?php
  2. require_once(&#092;"../../function/function.php\");
  3. include(&#092;"../../function/begin.php\");
  4. $page=$_GET[&#092;"page\"];
  5. if($page==2)
  6. include(&#092;"create_page2.php\");// lepiej taka opcje??
  7. elseif($page==3)
  8. create_page3(); // czy w ten sposob??
  9. elseif($page==4)
  10. create_page4();
  11. elseif($page==5)
  12. create_page5();
  13. elseif($page==6);
  14. elseif($page==7)
  15. create_page7();
  16. else
  17. create_page1();
  18. include(&#092;"../../function/end.php\");
  19. ?>


jak organizowac tego typu wyswietlanie?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dr_bonzo
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

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


OMG: TABLICE slyszeliscie o tablicach?

  1. <?php
  2. require_once(&#092;"../../function/funcphp\");
  3. include(&#092;"../../function/begin.php\");
  4. $page=$_GET[&#092;"page\"];
  5. $all_pages = array();
  6. $all_pages[ 0 ] = 'create_page0.php';
  7. $all_pages[ 1 ] = 'create_page1.php';
  8. //...
  9. $page = intval( $page )
  10. if ( ! in_array( $page, $all_pages ) )
  11. {
  12. die( 'Zla strona' ); // nie ma takiej strony
  13. }
  14. else
  15. {
  16. // includuj; wywolaj funkcje tworzaca strone z parametrem $numer_strony, itp
  17. require_once $all_pages[ $page ];
  18. }
  19. include(&#092;"../../function/end.php\");
  20. ?>
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: 4.10.2025 - 22:57