"Hello, world!" tutorial - langel/LOLkernel GitHub Wiki
Now is the time to give birth to your webapp! First, create a directory called 'app' inside of the LOLkernel directory. This is where all things make your webapp come to life will live in a specific way which we'll learn about as we go through this quick start guide. Next, create a directory called 'index' inside of the 'app' one. When LOLkernel gets an empty URL request this is the first place it looks for instructions. If LOLkernel does not detect any ready output it will default to it's SysOp interface.
At this point, there are 3 ways we could go about displaying the string "Hello, world!" to the browser.
1) Create 'LOLkernel/app/boot.php' and give it the following code --
<?php
$output = 'Hello, world!';
?>
$output is an especially reserved variable. If it is set then it will be the rendered content. If it is not set then a template is hunted for. If neither is set/exists then a 404 is thrown.
The file boot.php will be loaded everytime your webapp is accessed. This means that $output will display on every page loaded. While this gets our string on the page it's much too static to be usable. You might also think this is a good place to put your page's header but you're wrong. We'll learn about headers and footers later on....
2) Create 'LOLkernel/app/index/index.php' and move the code there from example 1. You get the same results. This is your app's index controller and it is loaded by default when no controller is specified in the URL.
3) Create 'LOLkernel/app/index/indexIndex.php' with 'Hello, world!' in it. This is your app's index template. By default $output is now ignored because a template is found. If you would like to see $output appear inside your template use the following code --
<?php echo $output; ?>
or use
<: $ouput ?>
which is a shorthand provided by the LOLkernel template system.