Quick links: Content - sections - sub sections
EN

Trace: 1.2beta1 1.2 1.2 1.2 jevent 1.1.x 1.4 1.1.5 hall-of-fame 1.1.x

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:minitutorial:1.1.x [2009/01/07 21:43] biboen:tutorials:minitutorial:1.1.x [2012/04/15 08:36] (current) laurent
Line 6: Line 6:
 ===== Download and installation ===== ===== Download and installation =====
  
-First, [[en:download:stable:1.1#developer-edition|download the "developer" edition of Jelix]]. Jelix requires at least PHP 5.2 (See [[en:manual-1.1:installation:requirements|here a detailed list of requirements]])+First, [[en:download:stable:1.1#developer-edition|download the "developer" edition of Jelix]]. Jelix requires at least PHP 5.2 (See [[http://docs.jelix.org/en/manual-1.1/installation/requirements|here a detailed list of requirements]])
  
 Then, unpack the archive file you have downloaded, with your archiver software companion. For example, with tar: Then, unpack the archive file you have downloaded, with your archiver software companion. For example, with tar:
Line 165: Line 165:
 </code> </code>
  
-Reload the page. The page title should now correctly display in your browser title bar. But still your page contains this:+Reload the page. The page title should now display accordingly in your browser title bar. But still your page contains this:
  
 {{en:tutorials:minitutorial:minituto_1_en.png}} {{en:tutorials:minitutorial:minituto_1_en.png}}
  
-How is this possible although we don'have anything in our controller ?+How is this possible whereas we don'define any content in our controller ?
  
-We saw that @@M@getResponse('html')@@ returns a @@C@jResponseHtml@@ object. However, it is possible to return an other object for the "html" type. It can be an other object which inherits from @@C@jResponseHtml@@and which set things which are common for all actions. For example: CSS style sheets, the main template etc. This is very useful because you don't need to repeat this settings in your actions. And because this is very useful, the @@createapp@@ command creates such class and a default template. This sort of classes are stored in the @@F@responses/@@ directory of the application, and are declared in the configuration file.+We have seen before that @@M@getResponse('html')@@ returns a @@C@jResponseHtml@@ object. However, it could return another object for the "html" type. It could be an instance of a class inheriting from @@C@jResponseHtml@@ and which set common things for all 'html' actions. Think about defining common CSS style sheets and JS scriptsyour application main template etc. This  class is very useful as you don't need to repeat this settings through all your actions. And because this is very useful, the @@createapp@@ command creates such class and a default template. it is stored in the @@F@responses/@@ directory of your application, and is declared in the configuration file.
  
 Let's see the content of @@F@example/responses/myHtmlResponse.class.php@@ created by @@createapp@@: Let's see the content of @@F@example/responses/myHtmlResponse.class.php@@ created by @@createapp@@:
Line 178: Line 178:
 class myHtmlResponse extends jResponseHtml { class myHtmlResponse extends jResponseHtml {
  
-    public $bodyTpl = 'exemple~main';+    public $bodyTpl = 'example~main';
  
     protected function doAfterActions() {     protected function doAfterActions() {
Line 186: Line 186:
 </code> </code>
  
-This "customized" response set up in @@P@bodyTpl@@ the default template which will be used to generate the @@<body>@@ content of all pages : "exemple~main". This is the @@F@main.tpl@@ file in the example module. "exemple~main" is called a selector. A [[en:manual-1.1:selectors|Jelix selector]] is a shortcut to refer to a resource of a module. Here is the content of this template:+This "customized" response assigns to its @@P@bodyTpl@@ member the default template which will be used to generate the @@<body>@@ content of all pages : "example~main". This is the @@F@main.tpl@@ file in the example module. "example~main" is called a selector. A [[http://docs.jelix.org/en/manual-1.1/selectors|Jelix selector]] is a shortcut to refer to a resource of a module. Here is the content of main.tpl:
  
 <code html> <code html>
-   <h1 class="apptitle">example<br/><span class="welcome">{@jelix~jelix.newapp.h1@}</span></h1>+   <h1 class="apptitle">Title for example<br/><span class="welcome">{@jelix~jelix.newapp.h1@}</span></h1>
    {$MAIN}    {$MAIN}
 </code> </code>
Line 195: Line 195:
 @@{$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 "jelix.newapp.h1" key and stored in the "jelix" module. @@{$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 "jelix.newapp.h1" key and stored in the "jelix" module.
  
-The method @@M@doAfterActions@@ is called after each action. In the example, it assigns @@"<p>no content</p>"@@ to the MAIN template variable if this variable doesn't exist yet  (so, if it is not set by the action).+@@M@doAfterActions@@ method is called after each action. In the example, it assigns @@"<p>no content</p>"@@ to the MAIN template variable if this variable doesn't exist yet  (so, if it is not set by the action).
  
 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:

en/tutorials/minitutorial/1.1.x.1231364597.txt.gz · Last modified: 2009/01/07 21:43 by bibo

Recent changes RSS feed Creative Commons License