Trace:
Differences ¶
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
en:tutorials:minitutorial:1.1.x [2009/01/03 00:15] – laurent | en:tutorials:minitutorial:1.1.x [2009/01/07 21:43] – bibo | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Mini Tutorial ====== | ====== Mini Tutorial ====== | ||
- | The goal of this tutorial is to quickly show you how you can develop an application with Jelix 1.1. | + | The goal of this tutorial is to quickly show how you can develop an application with Jelix 1.1. |
===== Download and installation ===== | ===== Download and installation ===== | ||
- | First, [[en: | + | First, [[en: |
- | Unarchive then the file you have downloaded, with your uncompress | + | Then, unpack |
<code bash> | <code bash> | ||
Line 14: | Line 14: | ||
</ | </ | ||
- | After this, you have a directory @@F@jelix-1.1/ | + | After this, you have a directory @@F@jelix-1.1/ |
- | For this tutorial, move the jelix-1.1 | + | For the purpose of this tutorial, move jelix-1.1 |
===== Jelix scripts ===== | ===== Jelix scripts ===== | ||
- | A script for command line, @@F@jelix.php@@, | + | A script for command line, @@F@jelix.php@@, |
<code bash> | <code bash> | ||
Line 27: | Line 27: | ||
</ | </ | ||
- | You have to use @@F@jelix.php@@ with the command line version of PHP and give it as parameter a Jelix command | + | You have to use @@F@jelix.php@@ with the command line version of PHP. this script requires, |
+ | To invoke a command : | ||
<code bash> | <code bash> | ||
php jelix.php --application_name command_name [options] [parameters] | php jelix.php --application_name command_name [options] [parameters] | ||
+ | </ | ||
+ | |||
+ | To invoke help: | ||
+ | <code bash> | ||
+ | php jelix.php help // generic help, lists all commands available | ||
+ | php jelix.php help command_name // specific command help | ||
</ | </ | ||
- | ===== Creation of an application | + | ===== Application creation |
- | Let's create the tree structure of the application using the @@createapp@@ command. | + | Let's create the tree structure of your application using @@createapp@@ command. |
<code bash> | <code bash> | ||
Line 42: | Line 49: | ||
</ | </ | ||
- | You will then get a @@F@example/ | + | As a result, you'll get an @@F@example/ |
example/ | example/ | ||
Line 55: | Line 62: | ||
- | ===== Creation of a module | + | ===== Module creation |
- | A module gathers a whole of actions. At least one is necessary in an application. This is why a module is created automatically when you run @@createapp@@ command. | + | A module gathers a whole set of actions |
Here is the directory which has been created: | Here is the directory which has been created: | ||
Line 76: | Line 83: | ||
- | If you want to create other modules later, | + | If you want to create other modules later, use @@createmodule@@ command : |
<code bash> | <code bash> | ||
Line 87: | Line 94: | ||
===== First display ===== | ===== First display ===== | ||
- | Before | + | Before |
For example, on linux (ubuntu or debian) : | For example, on linux (ubuntu or debian) : | ||
Line 96: | Line 103: | ||
</ | </ | ||
- | We are now ready to display the page. Your application is accessible at this URL: @@http:// | + | You are now ready for prime. Your application is accessible at this URL: @@http:// |
{{en: | {{en: | ||
- | You notice | + | Noticed |
Now you should see: | Now you should see: | ||
Line 111: | Line 118: | ||
===== Implementing an action ===== | ===== Implementing an action ===== | ||
- | Let's implement a default action. An action is a process which generates a page. It is implemented as a method in a class called a " | + | Let's implement a default action. An action is a process which generates a page. It is implemented as a method in a class called a " |
+ | |||
+ | Open @@F@example/ | ||
<code php> | <code php> | ||
Line 128: | Line 137: | ||
</ | </ | ||
- | We state here that we retrieve | + | What this code means is that **index** action of **default** controller retrieves |
- | @@C@jResponseHtml@@ has a @@P@body@@ property, which is a @@C@jTpl@@ object. jTpl is a template engine provided by Jelix. In the controller, you see that the @@C@assignZone()@@ method | + | @@C@jResponseHtml@@ has a @@P@body@@ property, which is a @@C@jTpl@@ object. jTpl is a template engine provided by Jelix. |
+ | |||
+ | In the action code above, you see a call to @@C@assignZone()@@ method. | ||
<code php> | <code php> | ||
Line 146: | Line 157: | ||
==== Response object ==== | ==== Response object ==== | ||
- | The @@C@jResponseHtml@@ object generates | + | a @@C@jResponseHtml@@ object generates |
+ | |||
+ | Let's define the title of the page. Add this in the @@M@index()@@ method, | ||
<code php> | <code php> | ||
Line 152: | Line 165: | ||
</ | </ | ||
- | Reload the page. The title of the page is now display in your browser title bar. But the page contains this: | + | Reload the page. The page title should |
{{en: | {{en: | ||
Line 180: | Line 193: | ||
</ | </ | ||
- | @@{$MAIN}@@ is an instruction which says: display the content of the template variable named @@V@MAIN@@. {@jelix~jelix.newapp.h1@} is an instruction which says: display the localized string (a string | + | @@{$MAIN}@@ is an instruction which says: display the content of the template variable named @@V@MAIN@@. {@jelix~jelix.newapp.h1@} is an instruction which says: display the localized string (a string |
The method @@M@doAfterActions@@ is called after each action. In the example, it assigns @@"< | The method @@M@doAfterActions@@ is called after each action. In the example, it assigns @@"< |