Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:tutorials:minitutorial:1.2.x [2011/02/28 12:48] – ilon | en:tutorials:minitutorial:1.2.x [2012/04/15 08:37] (current) – laurent |
---|
===== Download and installation ===== | ===== Download and installation ===== |
| |
First, [[en:download:stable:1.2#developer-edition|download the "developer" edition of Jelix]]. Jelix requires at least PHP 5.2 (See [[en:manual-1.2: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]]) |
| |
Unpack the archive file you have downloaded, with your archiver software companion. For example, with tar (replace x with you'r version): | Unpack the archive file you have downloaded, with your archiver software companion. For example, with tar (replace x with you'r version): |
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. |
</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.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@@: | 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> |
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 ==== |
| |
<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'); |
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|}} |
| |
| |
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 ===== |
| |
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|}} |
| |
| |
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. |
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 ===== |