Quick links: Content - sections - sub sections
EN

Trace: 1.7.x 1.3 1.0.1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:tutorials:main:creating-application [2007/09/16 14:50] laurenten:tutorials:main:creating-application [2012/04/15 08:30] (current) laurent
Line 1: Line 1:
 +We're going to create an application from scratch. Every Jelix application has a name : the name of its directory. We will call our application "news.org".
 +
 +We suppose that you installed the Developer Edition of Jelix as indicated on the [[http://docs.jelix.org/en/manual-1.0/installation/installation|installation]] page, and that you use the default configuration, without modifying the tree strucure. You must have installed PHP and PHP-CLI, as said in the same page, to use the jelix.php script.
 +
 +
 +===== Discovering Jelix-Scripts =====
 +
 +Jelix is provided with a script, jelix.php, which makes creation and modification of the different files of an application based on Jelix easy. It is necessary to invoke it with the command line version of PHP and to give as parameter a Jelix command name, with possible parameters and options.
 +
 +<code bash>
 +  php jelix.php [--application_name] command_name [options] [parameters]
 +</code>
 +
 +For this, open a console and go to the lib/jelix-scripts/ directory where jelix.php is placed.
 +
 +<code bash>
 +   cd lib/jelix-scripts/      # under linux
 +   cd lib\jelix-scripts\      # under windows
 +</code>
 +
 +To get help on all the available commands, type :
 +
 +<code bash>
 +   php jelix.php help
 +</code>
 +
 +You will have noticed that you must indicate to jelix.php (except for the help command), the name of the application on which the command apply. It is possible to avoid it. For this, you have to put the name of the application in an environment variable : JELIX_APP_NAME. For our example, do this :
 +
 +<code bash>
 +  export JELIX_APP_NAME="news.org"        # under linux
 +  set JELIX_APP_NAME=news.org             # under windows
 +</code>
 +
 +
 +Notice that you can execute the script from any directories. For example, you can type:
 +
 +<code bash>
 +  php jelix/path/lib/jelix-scripts/jelix.php --news.org createapp   # under linux
 +  php jelix\path\lib\jelix-scripts\jelix.php --news.org createapp   # under windows
 +</code>
 +
 +
 +===== Creation of an application =====
 +
 +Let's begin to create our application. Jelix proposes a command for creating all the tree structure of an application : createapp. Type then :
 +
 +<code bash>
 +php jelix.php createapp
 +</code>
 +
 +You then get a news.org/ directory, at the same level as the lib/ directory. Its content is :
 +
 +  news.org/
 +     modules/      the modules owned by your application
 +     plugins/      the plugins owned by your application
 +     var/config/   the configuration files of your application
 +     var/log/      the eventual log files
 +     var/themes/   the different possible themes in your application
 +     var/overloads/ will contain the different files that you will have redefined, resulting from modules
 +     www/          the root of the site
 +
 +Check that the temp/actu.org directory you have just created, has write permissions for the web server.
 +
 +
 +===== Creation of a module =====
 +
 +Now we have a skeleton of application, and we will have to create a module, because for the moment, our application can do nothing since there is no defined action. Indeed, we will have to declare and implement some actions. An action can be a page display, backup of a form, a webservice call, etc.
 +
 +The actions are grouped into distinct modules according to the domain or the fonction to which they are linked. We will for example create a module which will group the actions meant to display and manage the news. To do that, you have the createmodule command, which takes as parameter the name of the module that will be created.
 +
 +<code bash>
 +php jelix.php createmodule news
 +</code>
 +
 +By typing this command, Jelix has created for you a module named news with all its tree structure and some mandatory files :
 +
 +   news.org/modules/
 +              news/                the directory of the module
 +                module.xml          file discribing the identity of the module
 +                controllers/       the action processing classes.
 +                   default.classic.php   a controller
 +                classes/            your business classes and services
 +                daos/               the object-relationnal mapping files
 +                locales/            locale files ("properties" files)
 +                    en_EN/
 +                    fr_FR/
 +                templates/          templates of the module
 +                zones/              objects processing specific zones in a page
 +
 +We are now ready to define the actions.
  
Recent changes RSS feed Creative Commons License