A small example application

To get you started with Ismo.

I converted the old getting started guide to the new Ismo_Core structure in a hurry, so please forgive any mistakes and please do inform me if something is wrong.


Ok, so let's create our first application using Ismo_Core!

We'll use a directory in the webroot of a web server. If the webroot for the server running on foo.bar is a /var/www/html we'll put this small application in a sub directory called Ismo_Core_Example. So let's create that directory:

            $ cd /var/www/html
            $ mkdir Ismo_Core_Examples
            $ cd Ismo_Core_Examples

The application class

The application class is the entry point, so we'll start with it. Put the following in a file called do.php in the above created directory.



// create the loader for the state classes
$loader =& new Ismo_Core_Loaders_FileSystem();

// create the application class
$app =& new Ismo_Core_Application('Ismo_Core_Example');


We set the default state to be 'example'. That means that http://foo.bar/do.php will go to the state named example.

The state class

An application can't do anything without a state so let's create the example state. Put the following in a file named example.php in the above created directory:



class example extends Ismo_Core_State_HTTP
    function example()

    function execDefault()
        echo "<h1>Meow</h1>";

    function execHi()
        echo "<h1>Hi</h1>";

    function execHello()
        echo "<h1>Hello</h1>";


Now try to go to the following URL:s

URL styles

Ismo_Core supports two kinds of URL styles, a query parameter based one and a path-info based one. Where will be a chapter in the manual describing these later on.


This example was intentionally kept super simple. No templates were used and no database accessed. The files were not protected with a .htaccess file, which should really be done in a real application if the files are located in the webroot.

I left the templates and database access out because Ismo_Core was designed to be template engine independent. There are also many different ways to do database access, all of which should work fine together with Ismo_Core.

The template usage and database access method will of course vary depending on which solutions you choose for you application. But Ismo_Core will work fine with any choice you make. If you want to provide examples how to use Ismo_Core together with some specific solution, feel free to send them my way and I'll add them either here or in some other place in the manual.