Trace:
Differences ¶
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:tutorial:creating-application [2007/01/13 17:37] – laurent | en:tutorial:creating-application [2007/09/17 22:42] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Creating an application and a module ====== | + | This page has been moved to [[en:tutorials: |
- | + | ||
- | 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 " | + | |
- | + | ||
- | We suppose that you installed the Developer Edition of Jelix as indicated on the [[en: | + | |
- | + | ||
- | + | ||
- | ===== 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] | + | |
- | </ | + | |
- | + | ||
- | For this, open a console and go to the lib/ | + | |
- | + | ||
- | <code bash> | + | |
- | cd lib/ | + | |
- | cd lib\jelix-scripts\ | + | |
- | </ | + | |
- | + | ||
- | To get help on all the available commands, type : | + | |
- | + | ||
- | <code bash> | + | |
- | php jelix.php help | + | |
- | </ | + | |
- | + | ||
- | 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=" | + | |
- | set JELIX_APP_NAME=actu.org | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | + | ||
- | ===== 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 | + | |
- | </ | + | |
- | + | ||
- | You then get a actu.org/ directory, at the same level as the lib/ directory. Its content is : | + | |
- | + | ||
- | actu.org/ | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | Check that the temp/ | + | |
- | + | ||
- | + | ||
- | ===== Creation of a module ===== | + | |
- | + | ||
- | Now that we have a skeleton of application, | + | |
- | + | ||
- | The actions are grouped in distinct modules according to the domain, 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 | + | |
- | </ | + | |
- | + | ||
- | By typing this command, Jelix has created for you a module named news with all its tree structure and some mandatory files : | + | |
- | + | ||
- | | + | |
- | news/ the directory of the module | + | |
- | module.xml | + | |
- | controllers/ | + | |
- | | + | |
- | classes/ | + | |
- | daos/ the object-relationnal mapping files | + | |
- | locales/ | + | |
- | en_EN/ | + | |
- | fr_FR/ | + | |
- | templates/ | + | |
- | zones/ | + | |
- | + | ||
- | We are now ready to define the actions. | + | |
- | + | ||
- | ---- | + | |
- | * Next : [[en:tutorial:creating-action|Creating an action]] | + | |
- | * [[en: | + |