Created
July 31, 2009 17:07
-
-
Save sofadesign/159327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// LIMONADE SESSION FEATURES EXAMPLES | |
require_once 'lib/limonade.php'; | |
function configure() | |
{ | |
// by default, session is enable. It automaticaly start a session with LIM_SESSION_NAME as name | |
option('session', false); // disable | |
option('session', true); // enable | |
option('session', 'my_session_name'); // enable with a specific session name | |
} | |
dispatch('/', 'example_index'); | |
function example_index() | |
{ | |
// now you can manage session vars as normal | |
$_SESSION['my_var'] = 'my_value'; | |
return html( '<p><a href="' | |
. url_for('page_two') | |
. '">Go to page two</a></p>' ); | |
} | |
dispatch('/page_two', 'example_two'); | |
function example_two() | |
{ | |
// now accessing previously set session variable | |
$my_var = $_SESSION['my_var']; | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment