Quick links: Content - sections - sub sections
EN

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
en:tutorials:minitutorial:1.0.3 [2008/04/03 22:50] – created laurenten:tutorials:minitutorial:1.0.3 [2008/04/06 09:17] laurent
Line 30: Line 30:
  
 <code bash> <code bash>
-php jelix.php [--application_namecommand_name [options] [parameters]+php jelix.php --application_name command_name [options] [parameters]
 </code> </code>
  
Line 50: Line 50:
      var/log/       the log files      var/log/       the log files
      var/themes/    the different possible themes in your application      var/themes/    the different possible themes in your application
-     var/overloads/  will contain the different files that you will redefine, from other modules. +     var/overloads/  will contain the different files that you will redefine, from modules. 
      www/           the root of the site      www/           the root of the site
  
Line 91: Line 91:
  
 <code bash> <code bash>
-   chown www-data:www-data ../../temp/exemple ../../exemple/var/log +   sudo chown www-data:www-data ../../temp/example ../../example/var/log 
-   chmod 755 ../../temp/exemple ../../exemple/var/log+   sudo chmod 755 ../../temp/example ../../example/var/log
 </code> </code>
  
Line 106: Line 106:
  
  
 +===== Implementing an action =====
  
-STOP HEREtutorials not still updated for Jelix 1.0.3+Let's implement a default actionAn action is a process which generates a pageIt is implemented as a method in a class called a "controller", and a controller can implement several actionsOpen the //example/modules/example/controllers/default.classic.php// file:
  
 +<code php>
 +class defaultCtrl extends jController {
  
 +   function index () {
 +       $rep = $this->getResponse('html');
  
 +       // this is a call for the 'welcome' zone after creating a new application
 +       // remove this line !
 +       $rep->body->assignZone('MAIN', 'jelix~check_install');
  
 +       return $rep;
 +   }
 +}
 +</code>
  
-===== Action implementation =====+We state here that we retrieve a jResponseHtml object throw the //getResponse// method because of the "html" type as it is indicated. Then we return it to indicate that its content must be returned to the browser.
  
-Let's implement default actionOpen the controllers/default.classic.php file and modify the content this way :+ 
 +jResponseHtml has "body" property, which is a jTpl objectjTpl is a template engine provided by Jelix. In the controller, you see that the assignZone method is calledIt says: get the content of the 'check_install' zone which is stored in the 'jelix' module, and put this content into the template variable named "MAIN". You will see what is a zone later. 'Check_install' zone is a zone which show the main content of the start page. As we don't need it anymore, delete this line so you will have this in your controller:
  
 <code php> <code php>
Line 121: Line 134:
  
    function index () {    function index () {
-      $rep = $this->getResponse('html');+       $rep = $this->getResponse('html');
  
-      return $rep;+       return $rep;
    }    }
 } }
 </code> </code>
- 
-We state here that we retrieve the jResponseHtml object (because of the HTML type as it is indicated), and we return it to indicate that its content must be returned to the browser. 
- 
  
 ==== Response object ==== ==== Response object ====

en/tutorials/minitutorial/1.0.3.txt · Last modified: 2008/11/19 15:02 by 127.0.0.1

Recent changes RSS feed Creative Commons License