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/07 21:06] – bibo | en:tutorials:minitutorial:1.2.x [2011/02/28 14:59] – ilon | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Mini Tutorial ====== | ====== Mini Tutorial ====== | ||
- | The goal of this tutorial is to quickly show 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.2. |
===== Download and installation ===== | ===== Download and installation ===== | ||
- | First, [[en: | + | First, [[en: |
- | Then, unpack | + | Unpack |
<code bash> | <code bash> | ||
- | tar xzf jelix-1.1-dev.tar.gz | + | tar xzf jelix-1.2.x.x-dev.tar.gz |
</ | </ | ||
- | After this, you have a directory @@F@jelix-1.1/lib/@@ in which you'll find all libraries used by jelix, and jelix itself. | + | After this, you have a directory @@F@jelix-1.2.x.x-dev/lib/@@ in which you'll find all libraries used by jelix, and jelix itself. |
- | For the purpose of this tutorial, move jelix-1.1 folder in a directory of your web site. So that it will be accessible with a browser, at this URL for example: @@http:// | + | For the purpose of this tutorial, move jelix-1.2.x.x-dev |
===== Jelix scripts ===== | ===== Jelix scripts ===== | ||
Line 23: | Line 23: | ||
<code bash> | <code bash> | ||
- | cd lib/ | + | |
- | cd lib\jelix-scripts\ | + | |
</ | </ | ||
Line 36: | Line 36: | ||
To invoke help: | To invoke help: | ||
<code bash> | <code bash> | ||
- | php jelix.php help // generic help, lists all commands available | + | php jelix.php help # |
- | php jelix.php help command_name | + | php jelix.php help command_name |
</ | </ | ||
Line 103: | Line 103: | ||
</ | </ | ||
- | You are now ready for prime. Your application is accessible at this URL: @@http:// | + | You are now ready for prime. Your application is accessible at this URL: @@http:// |
{{en: | {{en: | ||
- | Noticed this message saying that a CSS file is missing ? Copy the @@F@jelix-1.1/ | + | Noticed this message saying that a CSS file is missing ? Copy the @@F@jelix/ |
Now you should see: | Now you should see: | ||
- | {{en: | + | {{:en: |
If there are some error messages in the " | If there are some error messages in the " | ||
Line 123: | Line 123: | ||
<code php> | <code php> | ||
- | class defaultCtrl extends jController { | + | /** |
+ | * @package | ||
+ | * @subpackage example | ||
+ | * @author | ||
+ | * @copyright 2010 yourname | ||
+ | * @link http:// | ||
+ | * @license | ||
+ | */ | ||
+ | class defaultCtrl extends jController { | ||
+ | /** | ||
+ | * | ||
+ | */ | ||
| | ||
$rep = $this-> | $rep = $this-> | ||
Line 145: | Line 156: | ||
<code php> | <code php> | ||
- | class defaultCtrl extends jController { | + | /** |
+ | * @package | ||
+ | * @subpackage example | ||
+ | * @author | ||
+ | * @copyright 2010 yourname | ||
+ | * @link http:// | ||
+ | * @license | ||
+ | */ | ||
+ | class defaultCtrl extends jController { | ||
+ | /** | ||
+ | * | ||
+ | */ | ||
| | ||
$rep = $this-> | $rep = $this-> | ||
Line 157: | Line 179: | ||
==== 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 163: | Line 187: | ||
</ | </ | ||
- | 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: | ||
- | How is this possible | + | How is this possible |
- | We saw that @@M@getResponse(' | + | We have seen before |
Let's see the content of @@F@example/ | Let's see the content of @@F@example/ | ||
<code php> | <code php> | ||
+ | /** | ||
+ | * @package | ||
+ | * @subpackage | ||
+ | * @author | ||
+ | * @copyright 2010 yourname | ||
+ | * @link http:// | ||
+ | * @license | ||
+ | */ | ||
+ | |||
+ | |||
+ | require_once (JELIX_LIB_CORE_PATH.' | ||
+ | |||
class myHtmlResponse extends jResponseHtml { | class myHtmlResponse extends jResponseHtml { | ||
- | public $bodyTpl = 'exemple~main'; | + | public $bodyTpl = 'example~main'; |
+ | |||
+ | function __construct() { | ||
+ | parent:: | ||
+ | |||
+ | // Include your common CSS and JS files here | ||
+ | } | ||
protected function doAfterActions() { | protected function doAfterActions() { | ||
+ | // Include all process in common for all actions, like the settings of the | ||
+ | // main template, the settings of the response etc.. | ||
+ | |||
$this-> | $this-> | ||
} | } | ||
Line 184: | Line 229: | ||
</ | </ | ||
- | This " | + | This " |
<code html> | <code html> | ||
- | < | + | < |
| | ||
</ | </ | ||
Line 193: | Line 238: | ||
@@{$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 which value depends on the lang) identified by the " | @@{$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 which value depends on the lang) identified by the " | ||
- | The method | + | @@M@doAfterActions@@ |
Now you know why there is a content displaying on the start page. Now let's modify the template with this content: | Now you know why there is a content displaying on the start page. Now let's modify the template with this content: | ||
Line 208: | Line 253: | ||
<code php> | <code php> | ||
+ | /** | ||
+ | * @package | ||
+ | * @subpackage | ||
+ | * @author | ||
+ | * @copyright 2010 yourname | ||
+ | * @link http:// | ||
+ | * @license | ||
+ | */ | ||
+ | |||
+ | |||
+ | require_once (JELIX_LIB_CORE_PATH.' | ||
+ | |||
class myHtmlResponse extends jResponseHtml { | class myHtmlResponse extends jResponseHtml { | ||
+ | |||
public $bodyTpl = ' | public $bodyTpl = ' | ||
- | + | ||
- | | + | function __construct() { |
parent:: | parent:: | ||
global $gJConfig; | global $gJConfig; | ||
- | $this-> | + | $this-> |
+ | // Include your common CSS and JS files here | ||
} | } | ||
+ | |||
protected function doAfterActions() { | protected function doAfterActions() { | ||
+ | // Include all process in common for all actions, like the settings of the | ||
+ | // main template, the settings of the response etc.. | ||
+ | |||
$this-> | $this-> | ||
} | } | ||
} | } | ||
- | |||
</ | </ | ||
Line 238: | Line 296: | ||
<code php> | <code php> | ||
+ | /** | ||
+ | * @package | ||
+ | * @subpackage example | ||
+ | * @author | ||
+ | * @copyright 2010 yourname | ||
+ | * @link http:// | ||
+ | * @license | ||
+ | */ | ||
+ | |||
class defaultCtrl extends jController { | class defaultCtrl extends jController { | ||
+ | /** | ||
+ | * | ||
+ | */ | ||
| | ||
$rep = $this-> | $rep = $this-> | ||
Line 302: | Line 371: | ||
Now type: | Now type: | ||
- | http:// | + | http:// |
You will see: | You will see: | ||
Line 313: | Line 382: | ||
To execute a specific action, you should add in the url the module name, the controller name, and the method name of the action. For our example, we can type: | To execute a specific action, you should add in the url the module name, the controller name, and the method name of the action. For our example, we can type: | ||
- | | + | |
If it doesn' | If it doesn' | ||
- | | + | |
See the manual for details. | See the manual for details. | ||
Line 331: | Line 400: | ||
You can change it later if you want. | You can change it later if you want. | ||
- | You can also change the " | + | You can also change the " |
===== Conclusion ===== | ===== Conclusion ===== |