08/5, @4:27pm: From 0.3 to 0.4, new Limonade features
You’ll find all changes in the CHANGES file, but let’s have a quick look to some new features:
Session features
Session starts automatically by defaut. Then you can access session variables like you use to do, with $_SESSION array.
You can disable sessions with the session option.
Flash features
Flash is a special use of sessions. A flash value will be available only on next request and will be deleted after. It’s very useful to raise errors on a form or to notice a successful action.
This is the same behaviour as in Rails, and the syntax is very closed to it:
-
flash($name, $value...)defines a flash for the next request - in views, you can get current flash values with the
$flasharray orflash_now($name)function.
Url rewriting support
Limonade now support url rewriting for beautiful urls.
With a .htaccess in your app folder
<IfModule mod_rewrite.c>
Options +FollowSymlinks
Options +Indexes
RewriteEngine on
# RewriteBase /my_app/ # if your app is in a subfolder
# test string is a valid files
RewriteCond %{SCRIPT_FILENAME} !-f
# test string is a valid directory
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [NC,L]
</IfModule>
And setting explicitly the option('base_uri') in your configure() function:
option('base_uri', '/my_app'); # '/' or same as the RewriteBase in your .htaccess
You can access your site with urls like http://your.new-website.com/my/limonade/path instead of http://your.new-website.com/?/my/limonade/path.