Table of Contents - LF path - Hello World - Admin - PHP
Lets write our first littlefoot app!
First off, [Install](http://littlefootcms.com/manual/byid/40) LittlefootCMS.
After installation, before customizing anything, you should have a littlefoot folder in public_html and an lf folder inside that. LF is defined as
/home/<user>/public_html/littlefoot/lf/system/bootstrap.php. You are welcome to move the installation around, just remember that LF points to that full path of that
lf folder .
Covers: Write an app. Attach it to the website. View it on the website.
1) Make a new folder at LF/apps/myfirstapp
2) Add an
index.php to it with the following contents:
3) Go to the Dashboard and add myfirstapp to the navigation by clicking it under the App Gallery
4) Click your domain at the top of the admin to visit the front end and navigate to the new navigation item.
5) You should see 'Hello World' printed on the page.
That's your app! Now let's add an Admin section to it.
The index.php is included for client-side requests. But some aspects of apps such as their management interface would ideally not be accessible to the client. Instead we use a separate file at 'lf/apps/myfirstapp/admin.php'. Create this file and add the following content:
To view this new file, log into the Littlefoot backend at 'http://youdomain.com/littlefoot/index.php/admin' (defualt user: "admin" pass: "pass"). You should see "myfirstapp" on the left navigation under Dashboard. All apps that have an admin.php are displayed here. Click any app to manage it. If you click 'myfirstapp', you should see "Hello Admin" displayed.
In the previos examples, you learned the difference between [index.php] and [admin.php]. All we used was text, no PHP.
Throw some PHP in in your
index.php. Try the following:
<h2>My App</h2> <p><?php echo date('F j, Y'); ?></p>
or if you want to go pure PHP:
<?php echo '<h2>MyApp</h2>'; echo '<p>'; echo date('F j, Y'); echo '</p>';
You can program an app without using any special littlefoot framework features.