J3.x

Developing an MVC Component/Developing a Basic Component/ru: Difference between revisions

From Joomla! Documentation

Created page with "*Используя ваш любимый веб-браузер, перейдите в панель администратора вашего Joomla! сайт. Адрес, н..."
No edit summary
Line 58: Line 58:
Теперь нам нужно установить компонент Hello World!. Есть два способа сделать это, оба показаны в [[S:MyLanguage/Installing an extension|Установке расширения]]. Здесь мы рассмотрим способ с использованием диспетчера расширений для Joomla!.  
Теперь нам нужно установить компонент Hello World!. Есть два способа сделать это, оба показаны в [[S:MyLanguage/Installing an extension|Установке расширения]]. Здесь мы рассмотрим способ с использованием диспетчера расширений для Joomla!.  


*Используя ваш любимый веб-браузер, перейдите в панель администратора вашего Joomla! сайт. Адрес, например, <tt><yoursite>/joomla/administrator/index.php</tt>. Для этого примера мы будем ориентироваться на <tt>localhost/joomla/administrator/index.php</tt>.!Н!*Выберите дополнительные модули Extensions {{rarr}} Manage {{rarr}} Install {{rarr}} Upload Package File {{rarr}} Choose File!Н!*Перейдите и выберите файл!Н!*Нажмите Кнопку " Загрузить & Установить
*Используя ваш любимый веб-браузер, перейдите в панель администратора вашего Joomla! сайт. Адрес, например, <tt><yoursite>/joomla/administrator/index.php</tt>. Для этого примера мы будем ориентироваться на <tt>localhost/joomla/administrator/index.php</tt>.!Н!
*Выберите дополнительные модули Extensions {{rarr}} Manage {{rarr}} Install {{rarr}} Upload Package File {{rarr}} Choose File!Н!
*Перейдите и выберите файл!Н!
*Нажмите Кнопку " Загрузить & Установить


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

Revision as of 18:02, 9 January 2016

Joomla! 
3.x
Tutorial
Developing an MVC Component



This is a multiple-article series of tutorials on how to develop a Model-View-Controller Component for Joomla! VersionJoomla 3.x.

Begin with the Introduction, and navigate the articles in this series by using the navigation button at the bottom or the box to the right (the Articles in this series).



== Примечания ==!Н!Этот учебник является частью Developing в создание MVC компонента для Joomla! 3.х: Учебное пособие. Вам рекомендуется прочитать предыдущие части учебника перед прочтением этой.

Если вы воспользовались Joomla! перед чтением данного руководства вы заметили, что расширения устанавливаются, используя сжатый файл, содержащий все вещи, которые необходимы для установки и удаления.

Вы можете следовать ниже, чтобы создать компонент Hello World!, или вы можете напрямую загрузить архив

Вот несколько слайдов на основе этого документа, объясняющие, как создавать простые для продвижения компоненты на Joomla! .
!Н!в Joomla! Основная Справка Компонента
!Н!в Joomla! Продвинутая Справка Компонента

== Как добавить компонент на Joomla! ==!Н!В данной статье мы рассмотрим, как создать и установить базовый компонент на Joomla! . В этом примере мы будем работать с компонентом Hello World!.

Чтобы начать, вы должны сначала использовать нужный файл менеджер для создания каталога для компонента Hello World! . Этот каталог может быть где угодно в файловой системе, пока это за пределами вашего Joomla! директорию. В этом примере мы назовем каталоге com_helloworld, но эта директория может называться как угодно.

Далее внутри этого каталога нужно создать несколько файлов. Используя ваш любимый файловый менеджер, создайте следующие файлы; Добавьте исходный код для каждого файла, который находится в " файл подробности".

1 helloworld.xml это XML-файл (манифест) файл, который говорит Joomla! как установить наш компонент.
2 site/helloworld.php это сайт точка входа для компонента Hello World!
3 site/index.html предотвращает листинг из веб-сервера содержимого директории
4 admin/index.html предотвращает листинг из веб-сервера содержимого директории
5 admin/helloworld.php это точка входа администратора в компонент Hello World!
6 admin/sql/index.html предотвращает листинг из веб-сервера содержимого директории
7 admin/sql/updates/index.html предотвращает листинг из веб-сервера содержимого директории
8 admin/sql/updates/mysql/index.html предотвращает листинг из веб-сервера содержимого директории
9 admin/sql/updates/mysql/0.0.1.sql файл, позволяющий инициализировать версию схемы компонента com_helloworld.

=== Установка Компонента Hello World! ===!Н!Используя ваш любимый файловый менеджер, создайте .zip файл из этого каталога. В данном примере мы будем использовать Имя файла com_helloworld.zipснова, хотя этот файл можно было назвать как угодно.

Теперь нам нужно установить компонент Hello World!. Есть два способа сделать это, оба показаны в Установке расширения. Здесь мы рассмотрим способ с использованием диспетчера расширений для Joomla!.

  • Используя ваш любимый веб-браузер, перейдите в панель администратора вашего Joomla! сайт. Адрес, например, <yoursite>/joomla/administrator/index.php. Для этого примера мы будем ориентироваться на localhost/joomla/administrator/index.php.!Н!
  • Выберите дополнительные модули Extensions    Manage    Install    Upload Package File    Choose File!Н!
  • Перейдите и выберите файл!Н!
  • Нажмите Кнопку " Загрузить & Установить

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

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

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

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

File Details

admin/sql/updates/mysql/0.0.1.sql is an empty file allowing to initialise schema version of the com_helloworld component.

helloworld.xml

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

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

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

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

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

</extension>

site/helloworld.php

Hello World

admin/helloworld.php

Hello World administration

index.html

common to all folders

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

Component Contents

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

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

Please create a pull request or issue at https://github.com/joomla/Joomla-3.2-Hello-World-Component for any code descprepancies or if editing any of the source code on this page.