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. The forum thread APF-Modul erstellen (German) and the Objektorientierte Implementierung eines Gästebuchs (German) article provide more complex application samples.
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 sub folder to store the templates files of the web page or application.
The template mentioned above contains the legendary sentence:
Hallo Welt! / Hello world!
To do the output, a PHP file must be created. This file is named index.php for now and must be callable via HTTP. The content of the PHP file must be:
// include the page controller (APF core library) include_once('./apps/core/pagecontroller/pagecontroller.php'); // include the front controller import('core::frontcontroller', 'Frontcontroller'); // create and configure front controller $fC = &Singleton::getInstance('Frontcontroller'); // start request processing and send result to the client echo $fC->start('sites::helloworld::pres::templates', 'helloworld');
If you now call the index.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 (Document-)Controller chapter.