Создание компонента Joomla! 1.6 (Часть 3) Добавляем тип пункта меню
Продолжаем цикл статей для тех, кто создает сайт на joomla! 1.6 своими руками. В Joomla! компоненты выполняются с использованием пунктов меню. Если вы хотите в менеджере меню своего сайта добавить тип меню (в нашем случае для компонента HelloWorld) , поместите в файл yoursite.ru/components/com_helloworld/views/helloworld/tmpl/default.xml (Где название файла xml должно соответствовать шаблону вывода, в данном случае шаблону default.php) строки:
Сначало прочтите создание компонента Joomla 1.6 (Часть 2)
 
<?xml version="1.0" encoding="utf-8"?>
<metadata>
 <layout title="COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE">
 <message>COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC</message>
 </layout>
</metadata>
 
Как преобразовать строки COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE и COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC в административной части мы рассмотрим в следующих статьях.
Установочный пакет компоненты
 * helloworld.xml
 * site/index.html
 * site/helloworld.php
 * site/controller.php
 * site/views/index.html
 * site/views/helloworld/index.html
 * site/views/helloworld/view.html.php
 * site/views/helloworld/tmpl/index.html
 * site/views/helloworld/tmpl/default.xml
 * site/views/helloworld/tmpl/default.php
 * admin/index.html
 * admin/helloworld.php
 * admin/sql/index.html
 * admin/sql/updates/index.html
 * admin/sql/updates/mysql/index.html
 * admin/sql/updates/mysql/0.0.1.sql
Создайте установочний файл ZIP или загрузите его  Установите его с помощью менеджера расширений Joomla!1.6. После установки Вы можете теперь в административной части создать новый пункт меню для нашего компонента.
Также необходимо внести изменения в helloworld.xml:
<extension type="component" version="1.6.0" method="upgrade">
 
 <name>Hello World!</name>
 <!-- The following elements are optional and free of formatting conttraints -->
 <creationDate>November 2009</creationDate>
 <author>John Doe</author>
 <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.3</version>
 <!-- The description is optional and defaults to the name -->
 <description>Description of the Hello World component ...</description>
 
 <update> <!-- Runs on update; New in 1.6 -->
 <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>
 <filename>controller.php</filename>
 <folder>views</folder>
 </files>
 
 <administration>
 <!-- Administration Menu Section -->
 <menu>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>
 
Далее читаем Продолжаем разработку компонента для Joomla! 1.6 (Часть 4)
 
			 
			
Комментарии
Вместо того чтобы критиковать, выразили бы благодарность!
2) Ссылаться на файлы ссылками типа "yoursite.ru/components/com_helloworld/views/helloworld/tmpl/default.xml" мягко говоря, неправильно. Писали бы что-нибудь типа {HOME_DIR}/components/...
3) На таком жутком фоне читать статьи ужасно неудобно :(
4) А так вообще полезно. Спасибо.