Hello world!
The present chapter describes a "quick&dirty" way to build a "hello world!" application with the
adventure php framework. The
my first website tutorial
explains - based on this hello world! example - an easy example of a website. More complex examples
can be found in the tutorial section, e.g. the
guestbook and the
contact form tutorial.
In order to display the ordinary "hello world!" text a master template must be created. The template
file will be stored under
apps/sites/helloworld/pres/templates/ as described in the
basics section and gets the name
helloworld.html. The structure of the
sites/helloworld folder
contains the folder
pres to store all contents belonging to the presentation layer
and the
templates subfolder to store the templates files of the webpage or application.
Please note, that this formation is only best practice. If you want, you can create your own folder
structure as desired.
The template mentioned above contains the legendary sentence:
Code
Hallo Welt! / Hello world!
To do the output, a PHP file must be created. This file is named
helloworld.php for
now and must be callable via HTTP. The content of the PHP file must be:
PHP-Code
// include the page controller (must be done one time in the bootstrap file)
include_once('./apps/core/pagecontroller/pagecontroller.php');
// create and output the page
$page = new Page();
$page->loadDesign('sites::helloworld::pres::templates','helloworld');
echo $page->transform();
If you now call the
helloworld.php file, the text "
Hallo Welt! / Hello world!"
will be displayed.
With it a program executable under the Framework was already provided. To intensify the content, a
document controller must be defined which fills the contents of the site as desired. More on
controllers can be found on the
controller page.
Comments
Do you want to add a comment to the article above, or do you want to post additional hints? So please click
here. Comments already posted can be found below.
There are no comments belonging to this article.