Quick links: Content - sections - sub sections
EN

Trace: 1.2beta1 about 1.0.7 1.2 hall-of-fame 1.2.x 1.4.x 1.4 1.2 1.2.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.2.x [2011/02/28 11:39] ilonen:tutorials:minitutorial:1.2.x [2012/04/15 08:37] (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.2#developer-edition|download the "developer" edition of Jelix]]. Jelix requires at least PHP 5.2 (See [[http://docs.jelix.org/en/manual-1.2/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:+Unpack the archive file you have downloaded, with your archiver software companion. For example, with tar (replace x with you'r version):
  
 <code bash> <code bash>
-  tar xzf jelix-1.1-dev.tar.gz+  tar xzf jelix-1.2.x.x-dev.tar.gz
 </code> </code>
  
-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.folder in a directory of your web site. So that it will be accessible with a browser, at this URL for example: @@http://localhost/jelix-1.1/@@ (You can rename @@F@jelix-1.1/@@ as you wish).+For the purpose of this tutorial, move jelix-1.2.x.x-dev folder in a directory of your web site. So that it will be accessible with a browser, at this URL for example: @@http://localhost/jelix-1.2.x.x-dev/@@ (You can rename @@F@jelix-1.2.x.x-dev/@@ as you wish, for the rest of this guide, we assume you rename this directory to "jelix".).
  
 ===== Jelix scripts ===== ===== Jelix scripts =====
Line 23: Line 23:
  
 <code bash> <code bash>
-   cd lib/jelix-scripts/        # under linux +   cd jelix/lib/jelix-scripts/        # under linux 
-   cd lib\jelix-scripts\        # under windows +   cd jelix\lib\jelix-scripts\        # under windows 
 </code> </code>
  
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              # generic help, lists all commands available  
-php jelix.php help command_name // specific command help+php jelix.php help command_name specific command help
 </code> </code>
  
Line 103: Line 103:
 </code> </code>
  
-You are now ready for prime. Your application is accessible at this URL: @@http://localhost/jelix-1.1/example/www/@@. Enter this URL in your browser. you should see:+You are now ready for prime. Your application is accessible at this URL: @@http://localhost/jelix/example/www/@@. Enter this URL in your browser. you should see:
  
 {{en:tutorials:minitutorial:start_page_white_en.png}} {{en:tutorials:minitutorial:start_page_white_en.png}}
  
-Noticed this message saying that a CSS file is missing ? Copy the @@F@jelix-1.1/lib/jelix-www@@  directory into @@F@jelix-1.1/example/www@@  by renaming it to "jelix" (on a dedicated apache server, it is better to create an alias). This directory is important because it contains some files needed by jForms or other components.+Noticed this message saying that a CSS file is missing ? Copy the @@F@jelix/lib/jelix-www@@  directory into @@F@jelix/example/www@@  by renaming it to "jelix" (on a dedicated apache server, it is better to create an alias). This directory is important because it contains some files needed by jForms or other components.
  
 Now you should see: Now you should see:
  
-{{en:tutorials:minitutorial:start_page_en.png}}+{{:en:tutorials:minitutorial:start_page_en-1.2.png?500}}
  
 If there are some error messages in the "installation check" section, fix them. If there are some error messages in the "installation check" section, fix them.
Line 123: Line 123:
  
 <code php> <code php>
-class defaultCtrl extends jController {+/** 
 +* @package   example 
 +* @subpackage example 
 +* @author    yourname 
 +* @copyright 2010 yourname 
 +* @link      http://www.yourwebsite.undefined 
 +* @license    All right reserved 
 +*/
  
 +class defaultCtrl extends jController {
 +   /**
 +   *
 +   */
    function index () {    function index () {
        $rep = $this->getResponse('html');        $rep = $this->getResponse('html');
Line 145: Line 156:
  
 <code php> <code php>
-class defaultCtrl extends jController {+/** 
 +* @package   example 
 +* @subpackage example 
 +* @author    yourname 
 +* @copyright 2010 yourname 
 +* @link      http://www.yourwebsite.undefined 
 +* @license    All right reserved 
 +*/
  
 +class defaultCtrl extends jController {
 +   /**
 +   *
 +   */
    function index () {    function index () {
        $rep = $this->getResponse('html');        $rep = $this->getResponse('html');
Line 176: Line 198:
  
 <code php> <code php>
 +/**
 +* @package   example
 +* @subpackage 
 +* @author    yourname
 +* @copyright 2010 yourname
 +* @link      http://www.yourwebsite.undefined
 +* @license    All right reserved
 +*/
 +
 +
 +require_once (JELIX_LIB_CORE_PATH.'response/jResponseHtml.class.php');
 +
 class myHtmlResponse extends jResponseHtml { class myHtmlResponse extends jResponseHtml {
  
     public $bodyTpl = 'example~main';     public $bodyTpl = 'example~main';
 +
 +    function __construct() {
 +        parent::__construct();
 +
 +        // 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->body->assignIfNone('MAIN','<p>no content</p>');         $this->body->assignIfNone('MAIN','<p>no content</p>');
     }     }
Line 186: Line 229:
 </code> </code>
  
-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 [[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:+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.2/selectors|Jelix selector]] is a shortcut to refer to a resource of a module. Here is the content of @@F@example/module/example/templates/main.tpl@@:
  
 <code html> <code html>
Line 210: Line 253:
  
 <code php> <code php>
 +/** 
 +* @package   example 
 +* @subpackage  
 +* @author    yourname 
 +* @copyright 2010 yourname 
 +* @link      http://www.yourwebsite.undefined 
 +* @license    All right reserved 
 +*/ 
 +  
 +  
 +require_once (JELIX_LIB_CORE_PATH.'response/jResponseHtml.class.php'); 
 + 
 class myHtmlResponse extends jResponseHtml { class myHtmlResponse extends jResponseHtml {
 + 
     public $bodyTpl = 'example~main';     public $bodyTpl = 'example~main';
- +  
-    public function __construct() {+    function __construct() {
         parent::__construct();         parent::__construct();
         global $gJConfig;         global $gJConfig;
-        $this->addCSSLink($gJConfig->urlengine['jelixWWWPath'].'design/jelix.css'); +        $this->addCSSLink($gJConfig->urlengine['jelixWWWPath'].'design/jelix.css');  
 +        // 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->body->assignIfNone('MAIN','<p>no content</p>');         $this->body->assignIfNone('MAIN','<p>no content</p>');
     }     }
 } }
- 
 </code> </code>
  
 Now you see: Now you see:
  
-{{en:tutorials:minitutorial:minituto_2_en.png}}+{{:en:tutorials:minitutorial:minituto_2_en-1.2.png|}}
  
 ==== Your first content ==== ==== Your first content ====
Line 240: Line 296:
  
 <code php> <code php>
 +/**
 +* @package   example
 +* @subpackage example
 +* @author    yourname
 +* @copyright 2010 yourname
 +* @link      http://www.yourwebsite.undefined
 +* @license    All right reserved
 +*/
 + 
 class defaultCtrl extends jController { class defaultCtrl extends jController {
 +   /** 
 +   * 
 +   */
    function index () {    function index () {
       $rep = $this->getResponse('html');       $rep = $this->getResponse('html');
Line 255: Line 322:
 So here, we put "<p>Hello !</p>" in the "MAIN" template variable. We now see: So here, we put "<p>Hello !</p>" in the "MAIN" template variable. We now see:
  
-{{en:tutorials:minitutorial:minituto_3_en.png}}+{{:en:tutorials:minitutorial:minituto_3_en-1.2.png|}}
  
  
Line 292: Line 359:
 You see now: You see now:
  
-{{en:tutorials:minitutorial:minituto_4_en.png}}+{{:en:tutorials:minitutorial:minituto_4_en-1.2.png|}}
  
 ===== Retrieving parameters ===== ===== Retrieving parameters =====
Line 304: Line 371:
  
 Now type: Now type:
-    http://localhost/jelix-1.1/example/www/index.php?name=Max+    http://localhost/jelix/example/www/index.php?name=Max
  
 You will see: You will see:
  
-{{en:tutorials:minitutorial:minituto_5_en.png}}+{{:en:tutorials:minitutorial:minituto_5_en-1.2.png|}}
  
  
Line 315: 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:
  
-   http://localhost/jelix-1.1/example/www/index.php/example/default/index+   http://localhost/jelix/example/www/index.php/example/default/index
  
 If it doesn't work, perhaps your server is not configured to accept pathinfo. You can then configure it or activating the "simple" url engine in the configuration of the application, and then type: If it doesn't work, perhaps your server is not configured to accept pathinfo. You can then configure it or activating the "simple" url engine in the configuration of the application, and then type:
  
-   http://localhost/jelix-1.1/example/www/index.php?module=example&action=default:index+   http://localhost/jelix/example/www/index.php?module=example&action=default:index
  
 See the manual for details. See the manual for details.
Line 333: Line 400:
 You can change it later if you want. You can change it later if you want.
  
-You can also change the "DocumentRoot" of the web site and to set it to the  @@F@jelix-1.1/exemple/www@@ directory, or move the content of the @@F@example/www@@ to the root of your web site.+You can also change the "DocumentRoot" of the web site and to set it to the  @@F@jelix/exemple/www@@ directory, or move the content of the @@F@example/www@@ to the root of your web site.
  
 ===== Conclusion ===== ===== Conclusion =====

en/tutorials/minitutorial/1.2.x.1298893183.txt.gz · Last modified: 2011/02/28 11:39 (external edit)

Recent changes RSS feed Creative Commons License