<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vomoa</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vomoa"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Vomoa"/>
	<updated>2026-05-16T13:31:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033323</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033323"/>
		<updated>2024-10-22T14:45:52Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Die Versionskennung für das Datenbankschema und die Versionskennung der Komponente müssen nicht identisch sein. Joomla übernimmt die Versionskennung für das Datenbankschem...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden: Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Die Versionskennung für das Datenbankschema und die Versionskennung der Komponente müssen nicht identisch sein. Joomla übernimmt die Versionskennung für das Datenbankschema aus dem Namen der Aktualisierungsdatei mit der höchsten Versionskennung. Deshalb wird empfohlen, dass es immer eine Aktualisierungsdatei gibt, sebst dann, wenn sie keinen Inhalt hat.&lt;br /&gt;
Wenn es erreicht werden soll, dass die Versionskennung für das Datenbankschema und die Versionskennung der Komponente immer identisch ist, dann kann folgende Vorgehensweise empfohlen werden: Soll der Code aktualisiert werden, dann kann eine Aktualisierungsdatei mit neuer Versionsnummer hinzugefügt werden, hier bei wird die Aktualisierungsdatei leer sein.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Hinzufügen eines neuen Feldtyps ==&lt;br /&gt;
Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part]. Jetzt möchten wird die Datenbank verwenden, um die Nachricht auszuwählen und hierfür müssen wir einen benutzerspezifischen Feldtyp mit der Bezeichnung &amp;quot;helloworld&amp;quot; definieren, siehe hierzu [S:MyLanguage/Creating_a_custom_form_field_type].&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; muss bearbeitet werden und um folgende Zeilen ergänzt werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dieser Code führt einen neuen Feldtyp ein und gibt Joomla die Anweisung die Definition des Feldes im Ordner &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; zu verwenden.&lt;br /&gt;
&lt;br /&gt;
Es gibt ein weiteres Tutorial, um mehr über Datenbankabfragen zu lernen. Hier wird erklärt wie Daten aus einer Datenbanktabelle in verschiedenen Formaten gelesen werden können: [[S:MyLanguage/Selecting_data_using_JDatabase|hier klicken]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/38/de&amp;diff=1033322</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/38/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/38/de&amp;diff=1033322"/>
		<updated>2024-10-22T14:45:52Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Die Versionskennung für das Datenbankschema und die Versionskennung der Komponente müssen nicht identisch sein. Joomla übernimmt die Versionskennung für das Datenbankschem...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Die Versionskennung für das Datenbankschema und die Versionskennung der Komponente müssen nicht identisch sein. Joomla übernimmt die Versionskennung für das Datenbankschema aus dem Namen der Aktualisierungsdatei mit der höchsten Versionskennung. Deshalb wird empfohlen, dass es immer eine Aktualisierungsdatei gibt, sebst dann, wenn sie keinen Inhalt hat.&lt;br /&gt;
Wenn es erreicht werden soll, dass die Versionskennung für das Datenbankschema und die Versionskennung der Komponente immer identisch ist, dann kann folgende Vorgehensweise empfohlen werden: Soll der Code aktualisiert werden, dann kann eine Aktualisierungsdatei mit neuer Versionsnummer hinzugefügt werden, hier bei wird die Aktualisierungsdatei leer sein.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033321</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033321"/>
		<updated>2024-10-22T14:34:39Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden: Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Hinzufügen eines neuen Feldtyps ==&lt;br /&gt;
Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part]. Jetzt möchten wird die Datenbank verwenden, um die Nachricht auszuwählen und hierfür müssen wir einen benutzerspezifischen Feldtyp mit der Bezeichnung &amp;quot;helloworld&amp;quot; definieren, siehe hierzu [S:MyLanguage/Creating_a_custom_form_field_type].&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; muss bearbeitet werden und um folgende Zeilen ergänzt werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dieser Code führt einen neuen Feldtyp ein und gibt Joomla die Anweisung die Definition des Feldes im Ordner &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; zu verwenden.&lt;br /&gt;
&lt;br /&gt;
Es gibt ein weiteres Tutorial, um mehr über Datenbankabfragen zu lernen. Hier wird erklärt wie Daten aus einer Datenbanktabelle in verschiedenen Formaten gelesen werden können: [[S:MyLanguage/Selecting_data_using_JDatabase|hier klicken]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1033320</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/37/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1033320"/>
		<updated>2024-10-22T14:34:38Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden: Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033297</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033297"/>
		<updated>2024-10-21T12:46:10Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Es gibt ein weiteres Tutorial, um mehr über Datenbankabfragen zu lernen. Hier wird erklärt wie Daten aus einer Datenbanktabelle in verschiedenen Formaten gelesen werden kön...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Hinzufügen eines neuen Feldtyps ==&lt;br /&gt;
Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part]. Jetzt möchten wird die Datenbank verwenden, um die Nachricht auszuwählen und hierfür müssen wir einen benutzerspezifischen Feldtyp mit der Bezeichnung &amp;quot;helloworld&amp;quot; definieren, siehe hierzu [S:MyLanguage/Creating_a_custom_form_field_type].&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; muss bearbeitet werden und um folgende Zeilen ergänzt werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dieser Code führt einen neuen Feldtyp ein und gibt Joomla die Anweisung die Definition des Feldes im Ordner &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; zu verwenden.&lt;br /&gt;
&lt;br /&gt;
Es gibt ein weiteres Tutorial, um mehr über Datenbankabfragen zu lernen. Hier wird erklärt wie Daten aus einer Datenbanktabelle in verschiedenen Formaten gelesen werden können: [[S:MyLanguage/Selecting_data_using_JDatabase|hier klicken]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/17/de&amp;diff=1033296</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/17/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/17/de&amp;diff=1033296"/>
		<updated>2024-10-21T12:46:08Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Es gibt ein weiteres Tutorial, um mehr über Datenbankabfragen zu lernen. Hier wird erklärt wie Daten aus einer Datenbanktabelle in verschiedenen Formaten gelesen werden kön...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Es gibt ein weiteres Tutorial, um mehr über Datenbankabfragen zu lernen. Hier wird erklärt wie Daten aus einer Datenbanktabelle in verschiedenen Formaten gelesen werden können: [[S:MyLanguage/Selecting_data_using_JDatabase|hier klicken]].&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033295</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033295"/>
		<updated>2024-10-21T12:40:55Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Dieser Code führt einen neuen Feldtyp ein und gibt Joomla die Anweisung die Definition des Feldes im Ordner &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; zu...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Hinzufügen eines neuen Feldtyps ==&lt;br /&gt;
Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part]. Jetzt möchten wird die Datenbank verwenden, um die Nachricht auszuwählen und hierfür müssen wir einen benutzerspezifischen Feldtyp mit der Bezeichnung &amp;quot;helloworld&amp;quot; definieren, siehe hierzu [S:MyLanguage/Creating_a_custom_form_field_type].&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; muss bearbeitet werden und um folgende Zeilen ergänzt werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dieser Code führt einen neuen Feldtyp ein und gibt Joomla die Anweisung die Definition des Feldes im Ordner &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; zu verwenden.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/16/de&amp;diff=1033294</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/16/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/16/de&amp;diff=1033294"/>
		<updated>2024-10-21T12:40:53Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Dieser Code führt einen neuen Feldtyp ein und gibt Joomla die Anweisung die Definition des Feldes im Ordner &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; zu...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Dieser Code führt einen neuen Feldtyp ein und gibt Joomla die Anweisung die Definition des Feldes im Ordner &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; zu verwenden.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033293</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033293"/>
		<updated>2024-10-21T12:37:31Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Hinzufügen eines neuen Feldtyps ==&lt;br /&gt;
Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part]. Jetzt möchten wird die Datenbank verwenden, um die Nachricht auszuwählen und hierfür müssen wir einen benutzerspezifischen Feldtyp mit der Bezeichnung &amp;quot;helloworld&amp;quot; definieren, siehe hierzu [S:MyLanguage/Creating_a_custom_form_field_type].&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; muss bearbeitet werden und um folgende Zeilen ergänzt werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/15/de&amp;diff=1033292</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/15/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/15/de&amp;diff=1033292"/>
		<updated>2024-10-21T12:37:30Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; muss bearbeitet werden und um folgende Zeilen ergänzt werden:&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033291</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033291"/>
		<updated>2024-10-21T12:36:48Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the si...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Hinzufügen eines neuen Feldtyps ==&lt;br /&gt;
Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part]. Jetzt möchten wird die Datenbank verwenden, um die Nachricht auszuwählen und hierfür müssen wir einen benutzerspezifischen Feldtyp mit der Bezeichnung &amp;quot;helloworld&amp;quot; definieren, siehe hierzu [S:MyLanguage/Creating_a_custom_form_field_type].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/14/de&amp;diff=1033290</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/14/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/14/de&amp;diff=1033290"/>
		<updated>2024-10-21T12:36:47Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the si...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Bisher haben wir einen Feldtyp für die Nachricht verwendet, welcher statisch vorgegeben war, siehe [S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part]. Jetzt möchten wird die Datenbank verwenden, um die Nachricht auszuwählen und hierfür müssen wir einen benutzerspezifischen Feldtyp mit der Bezeichnung &amp;quot;helloworld&amp;quot; definieren, siehe hierzu [S:MyLanguage/Creating_a_custom_form_field_type].&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033289</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033289"/>
		<updated>2024-10-21T12:26:19Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Hinzufügen eines neuen Feldtyps ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Hinzufügen eines neuen Feldtyps ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/13/de&amp;diff=1033288</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/13/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/13/de&amp;diff=1033288"/>
		<updated>2024-10-21T12:26:19Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Hinzufügen eines neuen Feldtyps ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Hinzufügen eines neuen Feldtyps ==&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033287</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033287"/>
		<updated>2024-10-21T12:25:36Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/46/de&amp;diff=1033286</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/46/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/46/de&amp;diff=1033286"/>
		<updated>2024-10-21T12:25:35Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Dies kann durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] erreicht werden (gültig seit Joomla 3.4.0).&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033285</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033285"/>
		<updated>2024-10-21T12:23:34Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der V...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.] &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/45/de&amp;diff=1033284</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/45/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/45/de&amp;diff=1033284"/>
		<updated>2024-10-21T12:23:32Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der V...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Es ist im Allgemeinen ratsam, dem Design-Muster von Joomla zu folgen. Dies ist von Vorteil bei der Wiederverwendung von zentralen Joomla-Javascript-Routinen, so auch bei der Verwendung von komplexeren Funktionalitäten, wie z.B. ACL (Access Control LIst - Zugriffskontrolliste) oder Verknüpfungen. Siehe hierzu auch weitere Folge dieses Tutorials (https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_ACL, https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_Associations).&lt;br /&gt;
[Die Übersetzung dieses Absatzes wurde verallgemeinert, da die im Original beschriebene Datenbankstruktur so nicht mehr verwendet wird.]&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033283</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033283"/>
		<updated>2024-10-20T21:04:02Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1033282</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/37/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1033282"/>
		<updated>2024-10-20T21:04:00Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollte folgender Hinweis beachtet werden. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033281</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033281"/>
		<updated>2024-10-20T21:03:24Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1033280</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/37/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1033280"/>
		<updated>2024-10-20T21:03:20Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wenn bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033279</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1033279"/>
		<updated>2024-10-20T21:02:43Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/36/de&amp;diff=1033278</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/36/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/36/de&amp;diff=1033278"/>
		<updated>2024-10-20T21:02:42Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wenn eine neuere Version dieser Komponente installiert wird - es muss nicht unbedingt die nächst höhere Version sein, es können Versionen übersprungen werden - Joomla wird folgede Schritte ausführen:&lt;br /&gt;
* Aus der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wird die aktuelle Version des Datenbankschemas der Komponente gelesen - in unserem Beispiel entspricht diese dem Wert 0.0.6.&lt;br /&gt;
* Es werden die Dateinamen aller Dateien in dem Verzeichnis &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; gelesen und in numerisch aufsteigender Reihenfolge sortiert.&lt;br /&gt;
* Es werden die Aktualisierungsdateien der Dateinamen ausgeführt, wenn diese für eine höhere Schemaversion als die aktuelle Version gelten - es könnten z.B. die Dateien &amp;quot;0.0.7.sql&amp;quot;, &amp;quot;0.0.9.sql&amp;quot; und &amp;quot;0.0.10.sql&amp;quot; gefunden werden, welche in dieser Reihenfolge ausgeführt weden.&lt;br /&gt;
* Es wird die Information über das Datenbankschema aktualisiert. Hierbei wird die Version der zuletzt ausgeführten Aktualisierungsdatei übernommen - z.B. 0.0.10.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/30/de&amp;diff=1032769</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/30/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/30/de&amp;diff=1032769"/>
		<updated>2024-10-11T21:28:48Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/29/de&amp;diff=1032768</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/29/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/29/de&amp;diff=1032768"/>
		<updated>2024-10-11T21:28:41Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032766</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032766"/>
		<updated>2024-10-11T21:25:30Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Anzeige der gewählten Nachricht ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Anzeige der gewählten Nachricht ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/20/de&amp;diff=1032765</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/20/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/20/de&amp;diff=1032765"/>
		<updated>2024-10-11T21:25:28Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Anzeige der gewählten Nachricht ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Anzeige der gewählten Nachricht ==&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032764</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032764"/>
		<updated>2024-10-11T21:21:06Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Mitwirkende ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Mitwirkende ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/42/de&amp;diff=1032763</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/42/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/42/de&amp;diff=1032763"/>
		<updated>2024-10-11T21:21:05Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Mitwirkende ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Mitwirkende ==&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032762</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032762"/>
		<updated>2024-10-11T21:20:59Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschlä...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/28/de&amp;diff=1032761</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/28/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/28/de&amp;diff=1032761"/>
		<updated>2024-10-11T21:20:59Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschlä...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Gerne kann ein Pull-Request oder ein Issue auf https://github.com/joomla/Joomla-3.2-Hello-World-Component erstellt werden, falls es Unstimmigkeiten oder Verbesserungsvorschläge für den auf dieser Seite dargestellten Quellcode gibt.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032759</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032759"/>
		<updated>2024-10-11T21:16:10Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-us...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/27/de&amp;diff=1032758</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/27/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/27/de&amp;diff=1032758"/>
		<updated>2024-10-11T21:16:09Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-us...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Es kann eine komprimierte Datei aus diesem Verzeichnis erstellt werden oder diese direkt von [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] heruntergeladen werden. Die Datei kann dann über die Installation für Erweiterungen in Joomla installiert werden.&lt;br /&gt;
Es kann dann ein Menüpunkt dieser Komponente über den Menümanager im Backend hinzugefügt werden.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032757</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032757"/>
		<updated>2024-10-11T21:08:55Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Inhalt des Verzeichnisses mit dem Code&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Inhalt des Verzeichnisses mit dem Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/26/de&amp;diff=1032756</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/26/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/26/de&amp;diff=1032756"/>
		<updated>2024-10-11T21:08:54Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Inhalt des Verzeichnisses mit dem Code&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Inhalt des Verzeichnisses mit dem Code&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032755</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032755"/>
		<updated>2024-10-11T21:08:15Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Die Komponente zur Bereitstellung vorbereiten ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Die Komponente zur Bereitstellung vorbereiten ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/25/de&amp;diff=1032754</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/25/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/25/de&amp;diff=1032754"/>
		<updated>2024-10-11T21:08:14Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;== Die Komponente zur Bereitstellung vorbereiten ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Die Komponente zur Bereitstellung vorbereiten ==&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032753</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032753"/>
		<updated>2024-10-11T21:03:48Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenb...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1032752</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/37/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/37/de&amp;diff=1032752"/>
		<updated>2024-10-11T21:03:47Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenb...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wenn Sie bereits eine Versionen der Komponente ohne Datenbanknutzung veröffentlicht wurde, dann sollten sie folgenden Hinweis beachten. Mit der erstmaligen Nutzung der Datenbank durch die Komponente muss die Aktualisierungsdatei dann den gleichen Inhalt haben, wie die Installationsdatei.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032750</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032750"/>
		<updated>2024-10-11T20:53:42Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
If you have already released versions of your component when you introduce database use, as we have simulated in this tutorial series, then your first update file must have exactly the same content as the install file.  If you have not, then it should be empty.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/35/de&amp;diff=1032749</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/35/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/35/de&amp;diff=1032749"/>
		<updated>2024-10-11T20:53:41Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Joomla speichert die Version des Datenbankschemas der jeweiligen Komponente durch einen Datensatz in der Tabelle &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; wenn eine Komponente erstmalig installiert wird. Liegt z.B. eine Datei namens &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; vor, dann wird Joomla den Wert &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; in der Datenbank als Version speichern.&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032698</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032698"/>
		<updated>2024-10-11T10:23:40Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Kompone...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;br /&gt;
&lt;br /&gt;
Joomla keeps track of the database schema version of your component through a record in its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table. So when you first install a component, if there&#039;s a file called, say, &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;, then Joomla will store the value &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; it its schemas record. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
If you have already released versions of your component when you introduce database use, as we have simulated in this tutorial series, then your first update file must have exactly the same content as the install file.  If you have not, then it should be empty.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/34/de&amp;diff=1032697</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/34/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/34/de&amp;diff=1032697"/>
		<updated>2024-10-11T10:23:38Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Kompone...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Die Komponente besitzt eine Versionsnummer (diese ist innerhalb des Tags &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; in der Manifestdatei helloword.xml angegeben). Das Schema der Datenbank der Komponente besitzt eine eigene Versionsnummer (diese basiert auf den Dateinamen der Sql-Update-Dateien).&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032696</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032696"/>
		<updated>2024-10-11T10:14:49Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &amp;#039;st...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Your component has a version number (which is specified inside the &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; tag in your helloword.xml manifest file), and your component&#039;s database schema has its own version number (which is based on the filenames of the sql update files).&lt;br /&gt;
&lt;br /&gt;
Joomla keeps track of the database schema version of your component through a record in its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table. So when you first install a component, if there&#039;s a file called, say, &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;, then Joomla will store the value &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; it its schemas record. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
If you have already released versions of your component when you introduce database use, as we have simulated in this tutorial series, then your first update file must have exactly the same content as the install file.  If you have not, then it should be empty.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/46/de&amp;diff=1032695</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/46/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/46/de&amp;diff=1032695"/>
		<updated>2024-10-11T10:14:47Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &amp;#039;st...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Oft gibt es in der Datenbanktabelle ein Feld, in dem der Veröffentlichungs- bzw. Nichtveröffentlichungsstatus eines Eintrags festgehalten wird. Die Verwendung des Namens &#039;state&#039; innerhalb von Joomla wird nicht empfohlen, da dies zu Konflikten führen kann, stattdessen wird der Name &#039;published&#039; verwendet. &amp;lt;br /&amp;gt;&lt;br /&gt;
Hinweis: Wie kann man Joomla anweisen, den Wert des veröffentlichten Formularfeldes in einem Datenbankfeld mit einem anderen Namen zu speichern? Wir tun dies durch die Verwendung der Methode [[S:MyLanguage/Column alias|setColumnAlias()]] (seit Joomla 3.4.0).&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032694</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032694"/>
		<updated>2024-10-11T10:10:17Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Often you will find that the database table has a field to keep track of the published/unpublished state of an item. Using the name &#039;state&#039; within Joomla is not recommended as it can lead to conflicts, instead the name &#039;published&#039; is used.&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: How to tell Joomla to store the value of the published form field into a different name database field? We do this by using the method [[S:MyLanguage/Column alias|setColumnAlias()]] (since 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Your component has a version number (which is specified inside the &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; tag in your helloword.xml manifest file), and your component&#039;s database schema has its own version number (which is based on the filenames of the sql update files).&lt;br /&gt;
&lt;br /&gt;
Joomla keeps track of the database schema version of your component through a record in its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table. So when you first install a component, if there&#039;s a file called, say, &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;, then Joomla will store the value &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; it its schemas record. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
If you have already released versions of your component when you introduce database use, as we have simulated in this tutorial series, then your first update file must have exactly the same content as the install file.  If you have not, then it should be empty.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/15/de&amp;diff=1032693</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/15/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/15/de&amp;diff=1032693"/>
		<updated>2024-10-11T10:10:16Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Bearbeite die Datei &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; und ergänze folgende Zeilen:&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032692</id>
		<title>J3.x:Developing an MVC Component/Using the database/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Using_the_database/de&amp;diff=1032692"/>
		<updated>2024-10-11T10:09:21Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{:J3.1:Developing an MVC Component/de}}&lt;br /&gt;
== Einleitung ==&lt;br /&gt;
Dieses Tutorial ist ein Teil der Artikelserie mit Tutorials über [[S:MyLanguage/J3.3:Developing an MVC Component | Developing an MVC Component for Joomla! 3.3]]. Es wird empfohlen die vorherigen Teile des Tutorials zu lesen, bevor dieser Teil gelesen wird. Es wird auch empfohlen weitere Quellen über über Datenbankabfragen, die Auswahl von Daten aus einer Datenbanktabelle und das Abrufen von Daten in verschiedenen Formaten zu lesen.&lt;br /&gt;
&lt;br /&gt;
Zu diesem Teil gibt es auch drei Videos:&lt;br /&gt;
- Setup der Datenbank [https://www.youtube.com/watch?v=JWS_3rx8RzY the Database Setup]&lt;br /&gt;
- Anzeigen der Nachricht (unter Verwendung von JTable) [https://www.youtube.com/watch?v=rKEHDeFGlGM Displaying the message (using JTable)]&lt;br /&gt;
- Auswahl der Nachricht im Admin-Bereich (unter Verwendung von JDatabase) [https://www.youtube.com/watch?v=uEDNyG6pSEk Admin message selection (and JDatabase)].&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=JWS_3rx8RzY}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=rKEHDeFGlGM}}&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=uEDNyG6pSEk}}&lt;br /&gt;
&lt;br /&gt;
== Verwendung der Datenbank ==&lt;br /&gt;
Komponenten verwalten ihren Inhalt in der Regel über die Datenbank. Während der Installations-/Deinstallations-/Aktualisierungsphase einer Komponente können SQL-Abfragen mithilfe von SQL-Textdateien ausgeführt werden.&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor sollen zwei Dateien erstellt werden:&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/install.mysql.utf8.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
- &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;&lt;br /&gt;
Beide sollen den gleichen, folgenden Inhalt haben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/install.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/install.mysql.utf8.sql&#039;&#039;&#039; and &#039;&#039;&#039;admin/sql/updates/mysql/0.0.6.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE `#__helloworld` (&lt;br /&gt;
	`id`       INT(11)     NOT NULL AUTO_INCREMENT,&lt;br /&gt;
	`greeting` VARCHAR(25) NOT NULL,&lt;br /&gt;
	`published` tinyint(4) NOT NULL DEFAULT &#039;1&#039;,&lt;br /&gt;
	PRIMARY KEY (`id`)&lt;br /&gt;
)&lt;br /&gt;
	ENGINE =MyISAM&lt;br /&gt;
	AUTO_INCREMENT =0&lt;br /&gt;
	DEFAULT CHARSET =utf8;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `#__helloworld` (`greeting`) VALUES&lt;br /&gt;
(&#039;Hello World!&#039;),&lt;br /&gt;
(&#039;Good bye World!&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;Anmerkung.&amp;quot;&amp;quot; Für die aktuell verwendete Datenbankstruktur wird folgende Angabe empfohlen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
anstelle der oben genannten. InnoDB ist die modernere (und jetzt standardmäßige) MySQL-Datenbank-Engine, die MyISAM ersetzt, und mit dem Format utf8mb4 eine breitere Palette von Zeichensätzen einschließlich Emojis unterstützt. Es wurden jedoch nicht alle Teile des Tutorials mit dieser Einstellung getestet. Wenn die weiteren Teile der Tutorial-Serie durchgearbeitet und InnoDB verwendet wird, dann wird empfohlen diese Datei auch in den anderen Teilen des Tutorials zu aktualisieren. &lt;br /&gt;
&lt;br /&gt;
Also note that if you look at a Joomla database many of the key database tables have a field called &#039;title&#039; for the sort of information which we&#039;re storing in our &#039;greeting&#039; field. It&#039;s generally advisable to follow the Joomla pattern, and use &#039;title&#039; as the field name, as when we try to use more complex functionality (such as ACL and associations) some of the core Joomla javascript routines we want to reuse expect a &#039;title&#039; field to be present. (Something to consider changing when this tutorial series is next updated). &lt;br /&gt;
&lt;br /&gt;
Often you will find that the database table has a field to keep track of the published/unpublished state of an item. Using the name &#039;state&#039; within Joomla is not recommended as it can lead to conflicts, instead the name &#039;published&#039; is used.&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: How to tell Joomla to store the value of the published form field into a different name database field? We do this by using the method [[S:MyLanguage/Column alias|setColumnAlias()]] (since 3.4.0).&lt;br /&gt;
&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;install.mysql.utf8.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn diese Komponente installiert wird.&lt;br /&gt;
Die Datei &amp;lt;tt&amp;gt;updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt; wird ausgeführt, wenn ein Update durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Damit die Installation bzw. das Update durchgeührt werden kann, müssen die entsprechenden Dateien in der Datei &amp;lt;tt&amp;gt;helloworld.xml&amp;lt;/tt&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Wichtiger Hinweis:&#039;&#039;&#039; Wenn die SQL-Dateien in utf8 gespeichert wird, dann muss sichergestellt werden, dass sie als utf8 NOT BOM gespeichert wird, ansonsten wird die Abfrage mit dem MySQL-Fehler #1064 fehlschlagen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;helloworld.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;helloworld.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;13,17-26,58-61&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;3.0&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;name&amp;gt;Hello World!&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The following elements are optional and free of formatting constraints --&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;January 2018&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john.doe@example.org&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.org&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Copyright Info&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;License Info&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;!--  The version string is recorded in the components table --&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;0.0.6&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;!-- The description is optional and defaults to the name --&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Description of the Hello World component ...&amp;lt;/description&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;install&amp;gt; &amp;lt;!-- Runs on install --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt; &amp;lt;!-- Runs on uninstall --&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.mysql.utf8.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt; &amp;lt;!-- Runs on update; New since J2.5 --&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates/mysql&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- Site Main File Copy Section --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
		to copy FROM in the package to install therefore files copied&lt;br /&gt;
		in this section are copied from /site/ in the package --&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Menu Section --&amp;gt;&lt;br /&gt;
		&amp;lt;menu link=&#039;index.php?option=com_helloworld&#039;&amp;gt;Hello World!&amp;lt;/menu&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Administration Main File Copy Section --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- Note the folder attribute: This attribute describes the folder&lt;br /&gt;
			to copy FROM in the package to install therefore files copied&lt;br /&gt;
			in this section are copied from /admin/ in the package --&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;!-- Admin Main File Copy Section --&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;index.html&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;filename&amp;gt;helloworld.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
			&amp;lt;!-- SQL files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- tables files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;tables&amp;lt;/folder&amp;gt;&lt;br /&gt;
			&amp;lt;!-- models files section --&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit der Datei zur Deinstallation wird genau so verfahren:&lt;br /&gt;
&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/sql/uninstall.mysql.utf8.sql&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/sql/uninstall.mysql.utf8.sql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/sql/uninstall.mysql.utf8.sql&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DROP TABLE IF EXISTS `#__helloworld`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematische Nummerierung == &lt;br /&gt;
&lt;br /&gt;
Your component has a version number (which is specified inside the &amp;lt;tt&amp;gt;&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; tag in your helloword.xml manifest file), and your component&#039;s database schema has its own version number (which is based on the filenames of the sql update files).&lt;br /&gt;
&lt;br /&gt;
Joomla keeps track of the database schema version of your component through a record in its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table. So when you first install a component, if there&#039;s a file called, say, &amp;lt;tt&amp;gt;admin/sql/updates/mysql/0.0.6.sql&amp;lt;/tt&amp;gt;, then Joomla will store the value &amp;lt;tt&amp;gt;0.0.6&amp;lt;/tt&amp;gt; it its schemas record. &lt;br /&gt;
&lt;br /&gt;
When you next install a newer version of this component - it doesn&#039;t have to be the next version, you can skip versions - Joomla will do the following:&lt;br /&gt;
* it will retrieve the component&#039;s latest database schema version from its &amp;lt;tt&amp;gt;#__schemas&amp;lt;/tt&amp;gt; table - so it might find in our example the value 0.0.6. &lt;br /&gt;
* it will get the filenames of all the files in the &amp;lt;tt&amp;gt;admin/sql/updates/mysql/&amp;lt;/tt&amp;gt; directory, and organise them in numerically increasing order.&lt;br /&gt;
* it will process in order the update files which have filenames numerically after the current schema version - so it might find files called 0.0.7.sql, 0.0.9.sql and 0.0.10.sql, and process these in order. &lt;br /&gt;
* it will update the schemas record to have the number of the last update file which it processed - eg 0.0.10. &lt;br /&gt;
&lt;br /&gt;
If you have already released versions of your component when you introduce database use, as we have simulated in this tutorial series, then your first update file must have exactly the same content as the install file.  If you have not, then it should be empty.&lt;br /&gt;
&lt;br /&gt;
Although it may be a good idea to keep the two version numbers in step, you don&#039;t have to. Joomla takes the schema version from the name of the numerically last update file. That&#039;s why it is recommended that there should be an initial update file, even if it&#039;s empty. If you want to keep your schema numbers in step with the component version numbers when you update your code but not the database schema, you simply include an update file to go with the new release number, and that update file, too, will be empty.&lt;br /&gt;
&lt;br /&gt;
As you make subsequent releases of your component the database install file must always contain the full schema and the update files only need to contain any changes you have made to the schema since the last update.&lt;br /&gt;
&lt;br /&gt;
== Adding a new field type ==&lt;br /&gt;
For the moment, we have used a [[S:MyLanguage/J3.3:Developing an MVC Component/Adding a menu type to the site part|hard coded field type for messages]]. We need to use our database for choosing the message, and for this we need to define a custom field type (which we call &#039;&#039;helloworld&#039;&#039; below) as described [[S:MyLanguage/Creating_a_custom_form_field_type|here]].&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/views/helloworld/tmpl/default.xml&amp;lt;/tt&amp;gt; file and put these lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/views/helloworld/tmpl/default.xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/views/helloworld/tmpl/default.xml&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot; highlight=&amp;quot;8,11-16&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;metadata&amp;gt;&lt;br /&gt;
	&amp;lt;layout title=&amp;quot;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;message&amp;gt;COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC&amp;lt;/message&amp;gt;&lt;br /&gt;
	&amp;lt;/layout&amp;gt;&lt;br /&gt;
	&amp;lt;fields&lt;br /&gt;
			name=&amp;quot;request&amp;quot;&lt;br /&gt;
			addfieldpath=&amp;quot;/administrator/components/com_helloworld/models/fields&amp;quot;&lt;br /&gt;
			&amp;gt;&lt;br /&gt;
		&amp;lt;fieldset name=&amp;quot;request&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;field&lt;br /&gt;
					name=&amp;quot;id&amp;quot;&lt;br /&gt;
					type=&amp;quot;helloworld&amp;quot;&lt;br /&gt;
					label=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL&amp;quot;&lt;br /&gt;
					description=&amp;quot;COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC&amp;quot;&lt;br /&gt;
					/&amp;gt;&lt;br /&gt;
		&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/metadata&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It introduces a new field type and tells Joomla to look for the field definition in the &amp;lt;tt&amp;gt;/administrator/components/com_helloworld/models/fields&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
In order to learn more on database queries, selecting data from a database table and retrieving it in several formats [[S:MyLanguage/Selecting_data_using_JDatabase|click here]].&lt;br /&gt;
Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/models/fields/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/models/fields/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
JFormHelper::loadFieldClass(&#039;list&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Form Field class for the HelloWorld component&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class JFormFieldHelloWorld extends JFormFieldList&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * The field type.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @var         string&lt;br /&gt;
	 */&lt;br /&gt;
	protected $type = &#039;HelloWorld&#039;;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a list of options for a list input.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  array  An array of JHtml options.&lt;br /&gt;
	 */&lt;br /&gt;
	protected function getOptions()&lt;br /&gt;
	{&lt;br /&gt;
		$db    = JFactory::getDBO();&lt;br /&gt;
		$query = $db-&amp;gt;getQuery(true);&lt;br /&gt;
		$query-&amp;gt;select(&#039;id,greeting&#039;);&lt;br /&gt;
		$query-&amp;gt;from(&#039;#__helloworld&#039;);&lt;br /&gt;
		$db-&amp;gt;setQuery((string) $query);&lt;br /&gt;
		$messages = $db-&amp;gt;loadObjectList();&lt;br /&gt;
		$options  = array();&lt;br /&gt;
&lt;br /&gt;
		if ($messages)&lt;br /&gt;
		{&lt;br /&gt;
			foreach ($messages as $message)&lt;br /&gt;
			{&lt;br /&gt;
				$options[] = JHtml::_(&#039;select.option&#039;, $message-&amp;gt;id, $message-&amp;gt;greeting);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$options = array_merge(parent::getOptions(), $options);&lt;br /&gt;
&lt;br /&gt;
		return $options;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new field type displays a drop-down list of messages to choose from. You can see the result of this change in the menu manager section for the helloworld item.&lt;br /&gt;
&lt;br /&gt;
== Display the chosen message ==&lt;br /&gt;
When a menu item of this component is created/updated, Joomla stores the identifier of the message. The &amp;lt;tt&amp;gt;HelloWorldModelHelloWorld&amp;lt;/tt&amp;gt; model has now to compute the message according to this identifier and the data stored in the database. To do this is uses the [https://docs.joomla.org/Using_the_JTable_class JTable] functionality, which is an alternative to JDatabase if only CRUD operations on single records are required.&lt;br /&gt;
&lt;br /&gt;
Modify the &amp;lt;tt&amp;gt;site/models/helloworld.php&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;site/models/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;site/models/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * HelloWorld Model&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldModelHelloWorld extends JModelItem&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * @var array messages&lt;br /&gt;
	 */&lt;br /&gt;
	protected $messages;&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Method to get a table object, load it if necessary.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   string  $type    The table name. Optional.&lt;br /&gt;
	 * @param   string  $prefix  The class prefix. Optional.&lt;br /&gt;
	 * @param   array   $config  Configuration array for model. Optional.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  JTable  A JTable object&lt;br /&gt;
	 *&lt;br /&gt;
	 * @since   1.6&lt;br /&gt;
	 */&lt;br /&gt;
	public function getTable($type = &#039;HelloWorld&#039;, $prefix = &#039;HelloWorldTable&#039;, $config = array())&lt;br /&gt;
	{&lt;br /&gt;
		return JTable::getInstance($type, $prefix, $config);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Get the message&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   integer  $id  Greeting Id&lt;br /&gt;
	 *&lt;br /&gt;
	 * @return  string        Fetched String from Table for relevant Id&lt;br /&gt;
	 */&lt;br /&gt;
	public function getMsg($id = 1)&lt;br /&gt;
	{&lt;br /&gt;
		if (!is_array($this-&amp;gt;messages))&lt;br /&gt;
		{&lt;br /&gt;
			$this-&amp;gt;messages = array();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (!isset($this-&amp;gt;messages[$id]))&lt;br /&gt;
		{&lt;br /&gt;
			// Request the selected id&lt;br /&gt;
			$jinput = JFactory::getApplication()-&amp;gt;input;&lt;br /&gt;
			$id     = $jinput-&amp;gt;get(&#039;id&#039;, 1, &#039;INT&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Get a TableHelloWorld instance&lt;br /&gt;
			$table = $this-&amp;gt;getTable();&lt;br /&gt;
&lt;br /&gt;
			// Load the message&lt;br /&gt;
			$table-&amp;gt;load($id);&lt;br /&gt;
&lt;br /&gt;
			// Assign the message&lt;br /&gt;
			$this-&amp;gt;messages[$id] = $table-&amp;gt;greeting;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return $this-&amp;gt;messages[$id];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model now asks the &#039;&#039;TableHelloWorld&#039;&#039; to get the message. This table class has to be defined in &amp;lt;tt&amp;gt;admin/tables/helloworld.php&amp;lt;/tt&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;admin/tables/helloworld.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&#039;&#039;&#039;admin/tables/helloworld.php&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * @package     Joomla.Administrator&lt;br /&gt;
 * @subpackage  com_helloworld&lt;br /&gt;
 *&lt;br /&gt;
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.&lt;br /&gt;
 * @license     GNU General Public License version 2 or later; see LICENSE.txt&lt;br /&gt;
 */&lt;br /&gt;
// No direct access&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Hello Table class&lt;br /&gt;
 *&lt;br /&gt;
 * @since  0.0.1&lt;br /&gt;
 */&lt;br /&gt;
class HelloWorldTableHelloWorld extends JTable&lt;br /&gt;
{&lt;br /&gt;
	/**&lt;br /&gt;
	 * Constructor&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param   JDatabaseDriver  &amp;amp;$db  A database connector object&lt;br /&gt;
	 */&lt;br /&gt;
	function __construct(&amp;amp;$db)&lt;br /&gt;
	{&lt;br /&gt;
		parent::__construct(&#039;#__helloworld&#039;, &#039;id&#039;, $db);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You shouldn&#039;t see any differences, but if you access the database you should see a table named &#039;&#039;jos_helloworld&#039;&#039; with two columns: id and greeting. And two entries: &#039;&#039;Hello World!&#039;&#039; and &#039;&#039;Good bye World&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Packaging the component ==&lt;br /&gt;
&lt;br /&gt;
Content of your code directory&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[#helloworld.xml|helloworld.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/helloworld.php|site/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/controller.php|site/controller.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/view.html.php|site/views/helloworld/view.html.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/views/helloworld/tmpl/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/views/helloworld/tmpl/default.xml|site/views/helloworld/tmpl/default.xml]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_view_to_the_site_part#site/views/helloworld/tmpl/default.php|site/views/helloworld/tmpl/default.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|site/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#site/models/helloworld.php|site/models/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/helloworld.php|admin/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/install.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/uninstall.mysql.utf8.sql|admin/sql/uninstall.mysql.utf8.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/sql/updates/mysql/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#admin/sql/updates/mysql/0.0.1.sql|admin/sql/updates/mysql/0.0.1.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/sql/install.mysql.utf8.sql|admin/sql/updates/mysql/0.0.6.sql]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/models/fields/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/models/fields/helloworld.php|admin/models/fields/helloworld.php]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[S:MyLanguage/J3.2:Developing_an_MVC_Component/Developing_a_Basic_Component#index.html|admin/tables/index.html]]&#039;&#039;&lt;br /&gt;
* &#039;&#039;[[#admin/tables/helloworld.php|admin/tables/helloworld.php]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a compressed file of this directory or directly download the [https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-6-using-the-database.zip archive] and install it using the extension manager of Joomla. You can add a menu item of this component using the menu manager in the backend.&lt;br /&gt;
&lt;br /&gt;
{{notice|Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code discrepancies or if editing any of the source code on this page.}}&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:cdemko|Christophe Demko]]&lt;br /&gt;
*[[User:oaksu|Ozgur Aksu]]&lt;br /&gt;
*[[User:scionescire|Scionescire]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Adding a variable request in the menu type|Prev: Adding a variable request in the menu type|class=expand success}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;large-6 columns&amp;quot;&amp;gt;{{Basic button|S:MyLanguage/J3.x:Developing_an_MVC_Component/Basic backend|Next: Basic backend|class=expand}}&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Joomla! 3.x{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.0{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.1{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.2{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.3{{#translation:}}]]&lt;br /&gt;
[[Category:Joomla! 3.4{{#translation:}}]]&lt;br /&gt;
[[Category:Beginner Development{{#translation:}}]]&lt;br /&gt;
[[Category:Component Development{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials{{#translation:}}]]&lt;br /&gt;
[[Category:Tutorials in a Series{{#translation:}}]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/18/de&amp;diff=1032691</id>
		<title>Translations:J3.x:Developing an MVC Component/Using the database/18/de</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Translations:J3.x:Developing_an_MVC_Component/Using_the_database/18/de&amp;diff=1032691"/>
		<updated>2024-10-11T10:09:15Z</updated>

		<summary type="html">&lt;p&gt;Vomoa: Created page with &amp;quot;Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mit dem bevorzugten Dateimanager und Editor soll die Datei &amp;lt;tt&amp;gt;admin/models/fields/helloworld.php&amp;lt;/tt&amp;gt; erstellt werden, die folgenden Inhalt enthält:&lt;/div&gt;</summary>
		<author><name>Vomoa</name></author>
	</entry>
</feed>