Skip to content

Instantly share code, notes, and snippets.

@sofadesign
Created July 31, 2009 17:07
Show Gist options
  • Save sofadesign/159327 to your computer and use it in GitHub Desktop.
Save sofadesign/159327 to your computer and use it in GitHub Desktop.
<?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