Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Front Controller i pare innych pytań
daniel1302
post 11.04.2008, 18:43:10
Post #1





Grupa: Zarejestrowani
Postów: 602
Pomógł: 30
Dołączył: 1.08.2007
Skąd: Nowy Sącz

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


Czy dobrze zrozumiałem istotę wzorca MVC (wkońcu)?
Jeśli tak to ułatwi mi to pracę

  1. <?php
  2. //Wyświetl wszystkie błędy(0=niewyświetlaj nic)
  3.  
  4. /* Załaduj wymagane pliki */
  5. require_once 'includes/config.php'; //Konfiguracja
  6. require_once 'DL_Libary/DL_Framework.php'; //Funkcje
  7. require_once 'DL_Libary/DL_Controller.php'; //Kontroler
  8. require_once 'DL_Libary/DL_Model.php'; //Model
  9. require_once 'DL_Libary/DL_View.php'; //Widok
  10.  
  11. $oController = new DL_Controller;
  12. $test = '<br /><br /><br /><br /><br /><br />';
  13. error('Testowy Błąd');
  14. $oController -> view -> assign('test', $test);
  15. $oController -> view -> display('index');
  16. ?>




Teraz drugie pytanie
Lepiej jest przechowywać ustawienia w stałych czy w takiej postaci:
  1. <?php
  2. Class Config
  3. {
  4. /* Configuration framework*/
  5. static $framework = array(
  6. 'viewsDir' => 'views',
  7. 'libaryDir' => 'DL_Libary'
  8. );
  9.  
  10. /* Configuration system */
  11. static $system = array(
  12. 'webUrl' => 'http://localhost',
  13. );
  14.  
  15. /* Configuration database */
  16. static $database = array(
  17. 'host' => 'localhost',
  18. 'user' => 'root',
  19. 'pass' => '',
  20. 'database' => 'sss',
  21. 'type' => 'mysql',
  22. 'status' => false
  23. );
  24. }
  25. ?>

Ustawienia są na localhost więc sie nie boję

Ten post edytował daniel1302 11.04.2008, 18:45:24
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 Wersja Lo-Fi Aktualny czas: 31.07.2025 - 08:26