J3.x

Difference between revisions of "Developing an MVC Component/Developing a Basic Component/fr"

From Joomla! Documentation

< J3.x:Developing an MVC Component
(Created page with "Vous trouverez ci-dessous quelques diapositives basés sur cette documentation et permettant d'expliquer comment créer des composants Joomla! du plus simple au plus compliqu...")
(Created page with "== Comment ajouter un composant à Joomla ? == Dans cet article, vous découvrirez comment créer et installer un composant de base pour Joomla. Dans cet exemple, nous allons...")
Line 12: Line 12:
 
[http://bit.ly/joomlaWorkshopAdvance Composant complexe pour Joomla]
 
[http://bit.ly/joomlaWorkshopAdvance Composant complexe pour Joomla]
  
== How to add a component to Joomla! ==
+
== Comment ajouter un composant à Joomla ? ==
In this article we will cover how to create and install a basic Joomla! component. For this example we will be working with the Hello World! component.
+
Dans cet article, vous découvrirez comment créer et installer un composant de base pour Joomla. Dans cet exemple, nous allons travailler sur un composant : '''Hello World'''.
  
 
To begin, you must first use your preferred file manager to create a directory for the Hello World! component. This directory can be anywhere on your file system, as long as it outside of your Joomla! installation directory. For this example we will name the directory <tt>com_helloworld</tt>, but this directory can be named anything.
 
To begin, you must first use your preferred file manager to create a directory for the Hello World! component. This directory can be anywhere on your file system, as long as it outside of your Joomla! installation directory. For this example we will name the directory <tt>com_helloworld</tt>, but this directory can be named anything.

Revision as of 13:30, 1 October 2015

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎italiano • ‎português do Brasil • ‎русский • ‎العربية • ‎中文(中国大陆)‎ • ‎中文(台灣)‎
Joomla! 
3.x
Didacticiel
Développement d'un composant MVC

Ajout d'une requête de variable dans le type de menu

Utilisation de la base de données

Backend de base

Ajout de la gestion des langues

Ajout d'actions en backend

Ajout de décorations pour le backend

Ajout de vérifications

Ajout de catégories

Ajout de configuration

  1. Ajout d'ACL

Ajout d'un fichier script installation/désinstallation/mise à jour

Ajout d'un formulaire de frontend

  1. Ajout d'une image
  2. Ajout d'un plan
  3. Ajout d'AJAX
  4. Ajout d'un alias

Utilisation du filtre de langues

  1. Ajouter une fenêtre modale
  2. Ajout d'associations
  3. Ajout de Checkout
  4. Ajout d'un filtre
  5. Ajout de niveaux
  6. Ajout de versions
  7. Ajout de tags
  8. Ajout d'accès
  9. Ajout d'un processus de traitement
  10. Ajout d'un cache
  11. Ajout d'un fil d'actualité

Ajout d'un serveur de mise à jour

  1. Adding Custom Fields
  2. Upgrading to Joomla4



Ceci est une série qui regroupe plusieurs articles pour devenir un didacticiel sur la façon de développer un Composant pour Joomla! Joomla 3.x suivant le principe Modèle-Vue-Contrôleur.

Commencez avec l'introduction, et naviguez dans les articles de cette série soit à l'aide des boutons de navigation en bas des articles, soit grâce au menu de droite : Les articles de cette série.



Notes

Ce didacticiel fait partie de la série de didacticiels sur le Développement d'un Composant MVC pour Joomla! 3.x. Vous êtes invité à lire les articles précédents de cette série avant de lire celui-ci.

Si vous avez déjà utilisé Joomla! avant la lecture de ce didacticiel, vous avez remarqué que les extensions sont installées à l'aide d'un fichier compressé contenant tout ce qui est nécessaire à leur installation et leur désinstallation.

Vous pouvez suivre les étapes ci-dessous pour créer un composant "Hello World", ou vous pouvez télécharger directement l'archive

Vous trouverez ci-dessous quelques diapositives basés sur cette documentation et permettant d'expliquer comment créer des composants Joomla! du plus simple au plus compliqué.
Composant de base pour Joomla!
Composant complexe pour Joomla

Comment ajouter un composant à Joomla ?

Dans cet article, vous découvrirez comment créer et installer un composant de base pour Joomla. Dans cet exemple, nous allons travailler sur un composant : Hello World.

To begin, you must first use your preferred file manager to create a directory for the Hello World! component. This directory can be anywhere on your file system, as long as it outside of your Joomla! installation directory. For this example we will name the directory com_helloworld, but this directory can be named anything.

Next, inside this directory we need to create some files. Using your preferred file manager, create the following files; as you create the files, add the source code for each file which is found in File Details.

1 helloworld.xml this is an XML (manifest) file that tells Joomla! how to install our component.
2 site/helloworld.php this is the site entry point to the Hello World! component
3 site/index.html prevents web server from listing directory content
4 admin/index.html prevents web server from listing directory content
5 admin/helloworld.php this is the administrator entry point to the Hello World! component
6 admin/sql/index.html prevents web server from listing directory content
7 admin/sql/updates/index.html prevents web server from listing directory content
8 admin/sql/updates/mysql/index.html prevents web server from listing directory content
9 admin/sql/updates/mysql/0.0.1.sql file allowing to initialise schema version of the com_helloworld component.

Installing the Hello World! Component

Using your preferred file manager, create a .zip file of this directory. For this example we will name the file com_helloworld.zip, again this file could have been named anything.

Now we need to install the Hello World! component. There are two ways to do this, both are covered in Installing an Extension. Here we will cover the method using the Extension Manager of Joomla!.

  • Using your preferred web browser, navigate to the Administrator panel of your Joomla! site. The address would be <yoursite>/joomla/administrator/index.php. For this example we will navigate to localhost/joomla/administrator/index.php.
  • Click Extensions    Manage    Install    Upload Package File    Choose File
  • Navigate and Select File
  • Click Upload & Install

Note - You should see a message letting you know if the installation succeeded or failed.

You can test this basic function of the component by entering the Hello World! page for the site and administrator portions of your Joomla! website.

  • Using your preferred web browser, navigate to the Hello World! component page located on the site portion of your website. The address would be <yoursite>/joomla/index.php?option=com_helloworld. For this example we will navigate to localhost/joomla/index.php?option=com_helloworld.
  • Using your preferred web browser, navigate to the Hello World! component page located on the administrator portion of your website. The address would be <yoursite>/joomla/administrator/index.php?option=com_helloworld. For this example we will navigate to localhost/joomla/administrator/index.php?option=com_helloworld.

You can also notice that the Hello World! component is visible in the administrator site of your Joomla installation under the Components menu.

Détails du fichier

admin/sql/updates/mysql/0.0.1.sql est un fichier vide permettant d'initialiser la version de schéma du composant com_helloworld.

helloworld.xml

<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2.0" method="upgrade">

	<name>Hello World!</name>
	<!-- The following elements are optional and free of formatting constraints -->
	<creationDate>December 2013</creationDate>
	<author>John Doe</author>
	<authorEmail>john.doe@example.org</authorEmail>
	<authorUrl>http://www.example.org</authorUrl>
	<copyright>Copyright Info</copyright>
	<license>License Info</license>
	<!--  The version string is recorded in the components table -->
	<version>0.0.1</version>
	<!-- The description is optional and defaults to the name -->
	<description>Description of the Hello World component ...</description>

	<update> <!-- Runs on update; New since J2.5 -->
		<schemas>
			<schemapath type="mysql">sql/updates/mysql</schemapath>
		</schemas>
	</update>

	<!-- Site Main File Copy Section -->
	<!-- Note the folder attribute: This attribute describes the folder
		to copy FROM in the package to install therefore files copied
		in this section are copied from /site/ in the package -->
	<files folder="site">
		<filename>index.html</filename>
		<filename>helloworld.php</filename>
	</files>

	<administration>
		<!-- Administration Menu Section -->
		<menu link='index.php?option=com_helloworld'>Hello World!</menu>
		<!-- Administration Main File Copy Section -->
		<!-- Note the folder attribute: This attribute describes the folder
			to copy FROM in the package to install therefore files copied
			in this section are copied from /admin/ in the package -->
		<files folder="admin">
			<!-- Admin Main File Copy Section -->
			<filename>index.html</filename>
			<filename>helloworld.php</filename>
			<!-- SQL files section -->
			<folder>sql</folder>
		</files>
	</administration>

</extension>

site/helloworld.php

Hello World

admin/helloworld.php

Hello World administration

index.html

commun à tous les dossiers

<html><body bgcolor="#FFFFFF"></body></html>

Component Contents

At this point in the tutorial, your component should contain the following files:

1 helloworld.xml this is an XML (manifest) file that tells Joomla! how to install our component.
2 site/helloworld.php this is the site entry point to the Hello World! component
3 site/index.html prevents web server from listing directory content
4 admin/index.html prevents web server from listing directory content
5 admin/helloworld.php this is the administrator entry point to the Hello World! component
6 admin/sql/index.html prevents web server from listing directory content
7 admin/sql/updates/index.html prevents web server from listing directory content
8 admin/sql/updates/mysql/index.html prevents web server from listing directory content
9 admin/sql/updates/mysql/0.0.1.sql file allowing to initialise schema version of the com_helloworld component.

Contributors

Info non-talk.png
General Information

Merci de créer un pull request ou un rapport d'anomalie sur https://github.com/joomla/Joomla-3.2-Hello-World-Component pour toute incohérence dans le code ou pour modifier le code source de cette page.