Browsing articles by " admin"
Nov 27, 2010
admin

Prepare the application skeleton

At this step, Simplemvc should be configured. In this part, we will start building our new application called front which will be the front end application.
Lets create the squeleton needed for a standard application. Since all the code is driven by classes and that Simple MVC uses an autoloading mechanism, is is not necessary to place the classes in a defined folder. But it is good to have some logic decomposition of the classes. Also, this could facilitate to have a namespacing implementation. The Simple MVC Autoload system supports perfectly Namespaces. there is even a Namespaces branch at github.
Here is a sample :

$ mkdir business/front
$ cd business/front
$ mkdir controllers models views container forms helpers templates
$ cd ../../
$ tree
.
`-- business
    `-- front
        |-- container
        |-- controllers
        |-- forms
        |-- helpers
        |-- models
        |-- templates
        `-- views

This is what we need for the moment as folders in the business layer.
We should do one last thing to get the structure complete, under the root folder :

$ cd www
$ mkdir images scripts styles
$ tree
.
|-- images
|-- scripts
`-- styles

In the next section, we will start with the bootstrap file, check it here!

Nov 27, 2010
admin

Installation and configuration

Download & Installation

To Install Simple MVC, you can either do it directly through git hub via

git clone git://github.com/bachkoutou/Simple-MVC.git

or download and uncompress the files :

https://github.com/bachkoutou/Simple-MVC/zipball/master
https://github.com/bachkoutou/Simple-MVC/tarball/master

Once decompressed, here is the structure you should get :

|-- CHANGELOG
|-- INSTALL
|-- README
|-- business
|-- conf
|-- core
|-- sql
`-- www

Here is a description for each folder

  • CHANGELOG , INSTALL, README : common files concerning respectively the changelog, the installation manual and the read-me text.
  • business : The business folder, this is where you put your apps or modules. Each Module is created in a subfolder.
  • conf : The configuration folder
  • core : The Core API. You should not change this folder if you want to get updates for upcoming versions of the framework without having to troublshoot.
  • sql : just a folder for some sql script samples
  • www : the webroot folder: this is where your vhost should point.

Preparing the environment

For purposes like the autoload mechanism and eventual uploads, Simple MVC needs a temporary folder that should be Writable by the webserver. The configuration by default uses a relative folder that should be called tmp. So if your Simple MVC path is /path/to/simplemvc/, you should add a /path/to/simplemvc/tmp/ folder and give your apache user write access to it.
The second step is to point your virtual host to the webroot folder. To help you do that, there is a sample file under conf, called vhost-sample.conf. It simply tells the virtual host to point to the www directory.
here is the code of that file (we consider simplemvc installed under /var/www/simpleMVC/) :

<VirtualHost *:80>
    ServerName www.simpleMVC.dev
    DocumentRoot /var/www/simpleMVC/www
    <Directory /var/www/simpleMVC/www>
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Setting up the default application / module

There is no many things to set to get the framework working. However, I’ll be showing some placeholders that allow you to change some default values of the system.

Under conf/, you will find a configuration-changeMe.php file. Since SimpleMVC supports many  applications (which we call modules), you can specify a configuration file per module. For example, the configuration file for the module front will be named as configuration_front.php.
So if your module is called front for example, all you to do is to copy the configuration-changeMe.php file to a configuration_front.php and change the MODULE constant to “front”

 define('MODULE', '{moduleName}' . DS);
// will be
 define('MODULE', 'front' . DS);

We will talk about the configuration files later on this book. Let’s start to build our application! this is explained here!

Pages:«12