Trace:
Differences ¶
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
en:tutorials:minitutorial:1.0.3 [2008/04/06 09:50] – laurent | en:tutorials:minitutorial:1.0.3 [2008/04/06 10:41] – laurent | ||
---|---|---|---|
Line 242: | Line 242: | ||
+ | ==== Template of an action ==== | ||
+ | It should be more practical to put the content in a new template, dedicated to your action, for example in example/ | ||
- | + | Let's create | |
- | STOP HERE. tutorial not updated in the below content. | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ==== The template ==== | + | |
- | + | ||
- | Create a hello.tpl | + | |
<code xml> | <code xml> | ||
- | | + | <div class=" |
- | < | + | <h2>Message</h2> |
- | </ | + | |
- | + | ||
- | " | + | |
- | <code php> | + | <div class=" |
- | | + | </div> |
</ | </ | ||
- | + | " | |
- | + | ||
- | ==== As a summary ==== | + | |
- | + | ||
- | The code of the controller | + | |
<code php> | <code php> | ||
- | class defaultCtrl extends jController { | ||
- | |||
| | ||
$rep = $this-> | $rep = $this-> | ||
$rep-> | $rep-> | ||
- | | + | |
- | $rep->bodyTpl = 'hello'; | + | $tpl = new jTpl(); |
- | $rep-> | + | $tpl->assign('name',' |
+ | $rep-> | ||
| | ||
return $rep; | return $rep; | ||
} | } | ||
- | } | ||
</ | </ | ||
+ | Notice the use of the $tpl object. The " | ||
- | ===== First display ===== | + | You see now: |
+ | |||
+ | {{en: | ||
+ | |||
+ | |||
+ | STOP HERE. tutorial not updated in the below content. | ||
- | We are now ready to display our page. For this, give the following URL : | ||
- | http:// | ||
- | You will then see your html page, with the welcome message. | ||
- | The url can change regarding the configuration of your installation, | ||
===== Retrieving parameters ===== | ===== Retrieving parameters ===== | ||
Line 304: | Line 290: | ||
<code php> | <code php> | ||
$name = $this-> | $name = $this-> | ||
- | $rep-> | + | $tpl-> |
</ | </ | ||
- | Now type : | + | Now type: |
- | http:// | + | http:// |
+ | You will see: | ||
+ | |||
+ | {{en: | ||
+ | |||
+ | |||
+ | ===== URLs ===== | ||
+ | |||
+ | To execute a specific action, you should add in the url a " | ||
+ | |||
+ | | ||
+ | |||
+ | The action parameter has the following syntax: controller_name: | ||
+ | |||
+ | However, in our example, this parameters are optional because the action has been defined as the default one in the web site. The default action is specified in the // | ||
+ | |||
+ | <code ini> | ||
+ | startModule=" | ||
+ | startAction=" | ||
+ | </ | ||
+ | |||
+ | You can change it later if you want. | ||
+ | |||
+ | Well, this urls are not very friendly, and of course, you can change how URLS should look like. For example: http:// | ||
+ | |||
+ | You can also change the " | ||
===== Conclusion ===== | ===== Conclusion ===== | ||
- | This were the first concepts of Jelix. You can continue to discover | + | |
+ | This were the first concepts of Jelix. You can continue to discover | ||
----- | ----- |