lib directory into your Web project's home directory. Next, create a file named index.php and add the following contents to it:<?php
require_once 'lib/limonade.php';
// Application code goes here
run();
.htaccess file which will route all requests to a file named index.php:<IfModule mod_rewrite.c>
Options +FollowSymlinks
Options +Indexes
RewriteEngine on
# RewriteBase /path/ # If website in subdirectory, uncomment and change this
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [NC,L]
</IfModule>dispatch() method, which you'll use to identify each end point and its associated method. For instance, the following dispatch() call ties a method named welcome() to the website's home page:dispatch('/', 'welcome');welcome() method and within it, use Limonade's html() method to identify a view (page template) associated with the page:function welcome()
{
return html('index.html.php');
}views within your project home directory, so create that directory and within it, create a file named index.html.php, adding the following contents:<html>
<head>
<title>Welcome to My Exercise Diary</title>
</head>
<body>
<p>
Return often to receive updates about the trials and tribulations
surrounding raising my heart rate beyond 80bpm!
</p>
</body>
</html>
Click here for larger image
Figure 1. A Limonade-powered Homepage
dispatch() call and associated method for each. For instance, a route definition pointing to /about would look like this:dispatch('/about', 'about');
function about()
{
return html('about.html.php');
}title tags) would be quite a chore. Fortunately, you can eliminate the redundancy by using Limonade's layout feature. Let's explore this feature by modifying your welcome() method call to look like this:function welcome()
{
return html('index.html.php', 'layout.html.php');
}layout.html.php file contains the global template which the associated view is injected into with each request. The injection occurs where the global template outputs the $content variable, as demonstrated here:<html>
<head>
<title>Welcome to My Exercise Diary</title>
</head>
<body>
<?php echo $content; ?>
</body>
</html>index.html.php view, leaving only the introductory paragraph:<p>
Return often to receive updates about the trials and tribulations
surrounding raising my heart rate beyond 80bpm!
</p>