wiki:HelloWorld

Version 2 (modified by mahouni, 11 years ago) (diff)

--

Your Hello World Application

(under construction, please help to improve this site)

Let`s write a Hello World application for BW-Rox:
We call this modul "Hello" and create a new folder in the build directory therefore.

mkdir build/hello


We need to create the following files:

Filename Path
hello.ctrl.php build/hello/hello.ctrl.php
hello.model.php build/hello/hello.model.php
hello.view.php build/hello/hello.view.php
hello.xml build/hello/hello.xml



In a first step we are going to say hello without a database query. This means we don`t neet the model file at the moment. Have a look at the file hello.model.php?. It is more or less empty. There is only a class called Hello with a construct function.

What we need is the view file. There we can write our message to the world:hello.view.php?. This will be done with the function "hello()". Its job is to say hello.

Finally we need a place where we call the just created function hello() from the class HelloView in the file hello.view.php to show our text
on the website. This will be done in the command file hello.ctrl.php?.
In this file the rest of BW-page with its head, sidebar and disclaimer etc is loaded too.

Finished! let`s test it! ah no, before we test it: the file build.xml needs to be changed aswell and should look like this:

<?xml version="1.0" encoding="utf-8"?>

<build>

  <app name="Hello"/>

  <files>

    <file class="HelloController">hello.ctrl.php</file>

    <file class="Hello">hello.model.php</file>

    <file class="HelloView">hello.view.php</file>

  </files>

</build>

Save the files, open your browser and go to http://localhost/bewelcome.[[BR]]

Here you are on the BW main page.
Now we want to go to our hello world application page. The link could be in the tab bar where you already can see the other BW moduls like the forum, the groups, the FAQ etc.
But it`s not necessary. We can go to our application with the following adress:
http://localhost/bewelcome/htdocs/hello[[BR]]

and there we are!



next steps:

Say hello with html formated text from an extern file

(still needs to be documented)

Say hello with a simple database query

(still needs to be documented)

Say hello in many languages with a database query

(still needs to be documented)

Create a simple event & meeting calendar in BWRox

(still needs to be documented)



Attachments (1)

Download all attachments as: .zip