Here is something to watch out for when working with sessions.
Let's say you have two pages, Page A and Template Z. If Page A sets session data and includes Template Z, the session data is not properly registered for the execution of Template Z due to how session data is written *after* a script has executed [1].
As a result, your second page will not have the right session data, so you are a bit in a pickle. I'm sure there are other work arounds, perhaps with cookies or flat files, but you cannot use session data in that fashion.
The reason I have this setup is because I will have a number of Page A-Z's that will contain page specific content and one Template Z page that renders each page's specific content in the site layout. This way, the site content changing is independent of the style the site uses and the site style can change without modifying the actual content. It's a dynamically configurable site template design.
[1] See the "session_write_close" documentation page.
Session Handling
- Wstęp
- Instalacja/Konfiguracja
- Stałe predefiniowane
- Przykłady
- Sessions and security
- Session Funkcje
- session_cache_expire — Zwróć bieżący czas przedawnienia pamięci podręcznej
- session_cache_limiter — Pobierz i/lub ustaw bieżący ogranicznik pamięci podręcznej
- session_commit — Alias dla session_write_close
- session_decode — Dekoduje dane sesji ze stringu
- session_destroy — Niszczy wszystkie dane zarejestrowane w sesji
- session_encode — Koduje dane bieżącej sesji do postaci ciągu tekstowego
- session_get_cookie_params — Pobierz parametry ciasteczka sesyjnego
- session_id — Pobierz i/lub ustaw identyfikator bieżącej sesji
- session_is_registered — Sprawdź czy globalna zmienna jest zarejestrowana w sesji
- session_module_name — Pobierz i/lub ustaw moduł bieżącej sesji
- session_name — Pobierz i/lub ustaw nazwę bieżącej sesji
- session_regenerate_id — Zmienia bieżący identyfikator sesji na nowy, automatycznie wygenerowany
- session_register — Zarejestruj jedną lub więcej zmiennych globalnych w bieżącej sesji
- session_save_path — Pobierz i/lub ustaw ścieżkę zapisu bieżącej sesji
- session_set_cookie_params — Ustaw parametry ciasteczka sesyjnego
- session_set_save_handler — Ustawia funkcje użytkownika do przechowywania sesji
- session_start — Inicjalizuj dane sesji
- session_unregister — Wyrejestruj zmienną globalną z bieżącej sesji
- session_unset — Zwolnij wszystkie zmienne sesyjne
- session_write_close — Zapisz dane i zakończ sesję
Sessions
pushedx
02-Jul-2008 12:01
02-Jul-2008 12:01
