Developing a MVC Component/Introduction/fr: Difference between revisions
From Joomla! Documentation
Created page with "fr" |
Created page with "Joomla! 3.x Joomla! 3.0 Joomla! 3.1 Joomla! 3.2 Category:Joom..." |
||
| (12 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
<noinclude><languages /></noinclude> | <noinclude><languages /></noinclude> | ||
{{:J3.1:Developing a MVC Component/fr}} | {{:J3.1:Developing a MVC Component/fr}} | ||
==Notes== | ==Notes== | ||
This tutorial is adapted from [[User:Cdemko|Christophe Demko]]: | This tutorial is adapted from [[User:Cdemko|Christophe Demko]]: | ||
*[[S:MyLanguage/Developing a Model-View-Controller Component/2.5|Developing a Model-View-Controller Component/2.5]] | *[[S:MyLanguage/Developing a Model-View-Controller Component/2.5|Developing a Model-View-Controller Component/2.5]] | ||
'''WARNING:''' this tutorial will not repeat the comments of Demko. To see them, please have a look to the original tutorial for Joomla! 2.5: | |||
WARNING: this tutorial will not repeat the comments of Demko. To see them, | *[[S:MyLanguage/Developing_a_Model-View-Controller_Component/2.5/Introduction|Developing a MVC Component for Joomla! 2.5 - Introduction]] | ||
== Exigences techniques == | |||
*[[S:MyLanguage/Developing_a_Model-View-Controller_Component/2.5/ | |||
== | |||
You need Joomla! 3.0 (with PHP, MySQL and Apache/Microsoft IIS) or greater for this tutorial. | You need Joomla! 3.0 (with PHP, MySQL and Apache/Microsoft IIS) or greater for this tutorial. | ||
I gathered a lot of information and then I started to migrate the component of the new Joomla! 2.5 to 3.0. | I gathered a lot of information and then I started to migrate the component of the new Joomla! 2.5 to 3.0. | ||
Below is some important information used for migration: | Below is some important information used for migration. Please see also all the information about migration [[S:MyLanguage/Portal:Upgrading_Versions|Upgrading Versions]]. | ||
Paramétrez "display_errors" sur 'On' pour faciliter le débogage des erreurs. | |||
== Migration de Joomla! 2.5 vers Joomla! 3.0 == | |||
Remember that you need to add Legacy at any place where you are directly extending JModel, JView or JController. If it is indirect (like through JModelList) you don't have to, it's already taken care of. | Remember that you need to add Legacy at any place where you are directly extending JModel, JView or JController. If it is indirect (like through JModelList) you don't have to, it's already taken care of. | ||
Other than that and the fact that, as announced long ago, deprecated code has been removed (I'd guess that JParameter is the biggest impact), extensions should only need minor changes ... Although you will want to look at the output changes that Kyle is working on. | Other than that and the fact that, as announced long ago, deprecated code has been removed (I'd guess that JParameter is the biggest impact), extensions should only need minor changes ... Although you will want to look at the output changes that Kyle is working on. | ||
| Line 34: | Line 18: | ||
(Elin in development list) | (Elin in development list) | ||
Exemples : | |||
DS | DS | ||
Since we've removed the DS constant in 3.0, we need to replace the uses of the constant in com_media. The most unobtrusive change is to simply replace it with PHP's DIRECTORY_SEPARATOR constant since DS is an alias to that. | Since we've removed the DS constant in 3.0, we need to replace the uses of the constant in com_media. The most unobtrusive change is to simply replace it with PHP's DIRECTORY_SEPARATOR constant since DS is an alias to that. | ||
| Line 71: | Line 53: | ||
</source> | </source> | ||
Voici le code source : | |||
http://joomlacode.org/gf/project/hellojoomla3/frs/ | http://joomlacode.org/gf/project/hellojoomla3/frs/ | ||
== | == Nouveau MVC dans Joomla! 3.0 == | ||
"Version 12.1 of the platform introduced a new format for the model-view-controller paradigm. In principle, the classes JModel, JView and JController are now interfaces and the base abstract classes are now JModelBase, JViewBase and JControllerBase, respectively. In addition, all classes have been simplified, removing a lot of coupling with the Joomla! CMS, that was unnecessary for standalone Joomla! Platform applications." ... | "Version 12.1 of the platform introduced a new format for the model-view-controller paradigm. In principle, the classes JModel, JView and JController are now interfaces and the base abstract classes are now JModelBase, JViewBase and JControllerBase, respectively. In addition, all classes have been simplified, removing a lot of coupling with the Joomla! CMS, that was unnecessary for standalone Joomla! Platform applications." ... | ||
[http://developer.joomla.org/manual/chap-Joomla_Platform_Manual-MVC.html Joomla! Platform Manual MVC] | [http://developer.joomla.org/manual/chap-Joomla_Platform_Manual-MVC.html Joomla! Platform Manual MVC] | ||
{{:J3. | ==Contributeurs== | ||
| | * [[User:Ribafs|Ribafs]] | ||
| | |||
= | <div class="row"> | ||
<div class="large-6 columns">{{Basic button|S:MyLanguage/J3.x:Developing_a_MVC_Component/Introduction|Prev: Introduction|class=expand success}}</div> | |||
<div class="large-6 columns">{{Basic button|S:MyLanguage/J3.x:Developing_a_MVC_Component/Developing_a_Basic_Component|Next: Developing a Basic Component|class=expand}}</div> | |||
</div> | |||
<noinclude> | <noinclude> | ||
[[Category: | [[Category:Joomla! 3.x/fr|Joomla! 3.x]] | ||
[[Category:Joomla! 3. | [[Category:Joomla! 3.0/fr|Joomla! 3.0]] | ||
[[Category:Joomla! 3.1]] | [[Category:Joomla! 3.1/fr|Joomla! 3.1]] | ||
[[Category:Joomla! 3.2]] | [[Category:Joomla! 3.2/fr|Joomla! 3.2]] | ||
[[Category:Joomla! 3.3]] | [[Category:Joomla! 3.3/fr|Joomla! 3.3]] | ||
[[Category:Joomla! 3.4]] | [[Category:Joomla! 3.4/fr|Joomla! 3.4]] | ||
[[Category:Beginner Development/fr|Développement pour débutants]] | |||
[[Category:Component Development/fr|Développement de composants]] | |||
[[Category:Tutorials/fr|Didacticiels]] | |||
[[Category:Tutorials in a Series/fr|Didacticiels en série]] | |||
</noinclude> | </noinclude> | ||
Latest revision as of 18:35, 9 July 2015
J3.x:Developing a MVC Component/fr
Notes
This tutorial is adapted from Christophe Demko:
WARNING: this tutorial will not repeat the comments of Demko. To see them, please have a look to the original tutorial for Joomla! 2.5:
Exigences techniques
You need Joomla! 3.0 (with PHP, MySQL and Apache/Microsoft IIS) or greater for this tutorial. I gathered a lot of information and then I started to migrate the component of the new Joomla! 2.5 to 3.0. Below is some important information used for migration. Please see also all the information about migration Upgrading Versions. Paramétrez "display_errors" sur 'On' pour faciliter le débogage des erreurs.
Migration de Joomla! 2.5 vers Joomla! 3.0
Remember that you need to add Legacy at any place where you are directly extending JModel, JView or JController. If it is indirect (like through JModelList) you don't have to, it's already taken care of. Other than that and the fact that, as announced long ago, deprecated code has been removed (I'd guess that JParameter is the biggest impact), extensions should only need minor changes ... Although you will want to look at the output changes that Kyle is working on. Of course, if you are building standalone platform applications, the new MVC and JApplicationWeb/JApplicationCLI are completely the way you should work and the nice thing about the way we have done this is that the new packages are already right there on your server having arrived with the CMS. (Elin in development list)
Exemples : DS Since we've removed the DS constant in 3.0, we need to replace the uses of the constant in com_media. The most unobtrusive change is to simply replace it with PHP's DIRECTORY_SEPARATOR constant since DS is an alias to that.
(joomlacode)
if(!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
//$controller = JController::getInstance('HelloWorld');
$controller = JControllerLegacy::getInstance('HelloWorld');
//class HelloWorldViewHelloWorlds extends JView
class HelloWorldViewHelloWorlds extends JViewLegacy
class HelloWorldController extends JControllerLegacy
class HelloWorldModelHelloWorld extends JModelItemLegacy
class HelloWorldModelUpdHelloWorld extends JModelFormLegacy
JRegistry::getValue() now is JRegistry::get()
//Convert sample to JRegistry with LoadJSON - Sample from Joomla! 3.0 sourcecode
// $params = new JRegistry;
// $params->loadJSON($this->item->params);
// $this->item->params = $params;
$params = new JRegistry;
$params->loadString($item->params);
$item->params = $params;
Voici le code source : http://joomlacode.org/gf/project/hellojoomla3/frs/
Nouveau MVC dans Joomla! 3.0
"Version 12.1 of the platform introduced a new format for the model-view-controller paradigm. In principle, the classes JModel, JView and JController are now interfaces and the base abstract classes are now JModelBase, JViewBase and JControllerBase, respectively. In addition, all classes have been simplified, removing a lot of coupling with the Joomla! CMS, that was unnecessary for standalone Joomla! Platform applications." ... Joomla! Platform Manual MVC