<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Joomla! 1.5 - Open Source Content Management" -->
<?xml-stylesheet href="/components/com_jcomments/tpl/default/style.css?v=10" type="text/css"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>«Непутевые» заметки по Joomla! 1.5. Создание компонентов, модулей и плагинов с использованием PHP</title>
		<description></description>
		<link>http://tungusov.ru/component/content/frontpage.html</link>
		<lastBuildDate>Wed, 27 Oct 2021 07:24:12 +0000</lastBuildDate>
		<generator>Joomla! 1.5 - Open Source Content Management</generator>
		<language>ru-ru</language>
		<item>
			<title>Языковые файлы компонента</title>
			<link>http://tungusov.ru/adding-language-management.html</link>
			<guid>http://tungusov.ru/adding-language-management.html</guid>
			<description><![CDATA[<p>Joomla! 2.5 языковые файлы используются в четырех различных ситуациях:</p>
<ul>
<li>отображение компонента в интерфейсе пользователя</li>
<li>управление компонентом в интерфейсе администратора</li>
<li>при создании пункта меню для компонента</li>
<li>при установке компонента (введено с версии 1.7)</li>
</ul>
<p>Joomla! 2.5 для хранения языковых файлов использует 2 каталога (в зависимости от того как установлен компонент):</p>
<ul>
<li>administrator/language или language</li>
<li>administrator/component/*component*/language или component/*component*/language</li>
</ul>
<p><strong>Языковый файл для интерфейса пользователя</strong></p>
<p>Создайте файлы <span style="color: #0000ff;">site/language/en-GB/en-GB.com_helloworld.ini</span> и <span style="color: #0000ff;">site/language/ru-RU/ru-RU.com_helloworld.ini</span>, эти файлы содержат перевод для интерфейса пользователя. Пока эти файлы будут пустые.</p>
<p><strong>Языковый файл для интерфейса администратора</strong></p>
<p>Создайте файлы <span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.ini</span> и <span style="color: #0000ff;">admin/language/ru-RU/ru-RU.com_helloworld.ini</span>,  эти файлы содержат перевод для интерфейса администратора.</p>
<p><span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"This message will be displayed"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Greeting"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">admin/language/ru-RU/ru-RU.com_helloworld.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение для отображения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Приветствие"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span></pre>
</div>
</div>
</div>
<p><strong>Языковый файл используемый при создании пункта меню</strong></p>
<p>Создайте файлы <span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.sys.ini </span>и a<span style="color: #0000ff;">dmin/language/ru-RU/ru-RU.com_helloworld.sys.ini</span></p>
<p><span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.sys.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Hello World!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_DESCRIPTION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"This is the Hello World description"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Hello World"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"This view displays a selected message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MENU</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Hello World!"</span></span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">admin/language/ru-RU/ru-RU.com_helloworld.sys.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР!!!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_DESCRIPTION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Это описание нашего компонента Привет МИР!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Выберите вариант отображения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MENU</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!"</span></span></pre>
</div>
</div>
</div>
<p><strong>Языковый файл используемый при установке компонента</strong></p>
<p>Создайте файлы <span style="color: #0000ff;">language/en-GB/en-GB.com_helloworld.sys.ini</span> и <span style="color: #0000ff;">language/ru-RU/ru-RU.com_helloworld.sys.ini</span></p>
<p><span style="color: #0000ff;">language/en-GB/en-GB.com_helloworld.sys.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Hello World!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_DESCRIPTION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"This is the Hello World description"</span></span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">language/ru-RU/ru-RU.com_helloworld.sys.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_DESCRIPTION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Простой компонент приветствия"</span></span></pre>
</div>
</div>
</div>
<p>Измените файл <span style="color: #0000ff;">helloworld.xml</span>:</p>
<p>замените строку</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>com_helloworld<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>на</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>строку</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menu<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Привет МИР!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/menu<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>на</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menu<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>COM_HELLOWORLD_MENU<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/menu<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>строку</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Это простой компонент приветствия ...<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>на</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD_DESCRIPTION<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>в секцию <span style="color: #0000ff;">&lt;files folder="site"&gt;</span> добавьте строку</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>language<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>в секцию <span style="color: #0000ff;">&lt;administration&gt;</span> добавьте строки</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;languages</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"admin"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"en-GB"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/en-GB/en-GB.com_helloworld.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"en-GB"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/en-GB/en-GB.com_helloworld.sys.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"ru-RU"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/ru-RU/ru-RU.com_helloworld.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"ru-RU"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/ru-RU/ru-RU.com_helloworld.sys.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/languages<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>В итоге файл <span style="color: #0000ff;">helloworld.xml</span> будет содержать следующий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;extension</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"component"</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"2.5.0"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"upgrade"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- The following elements are optional and free of formatting constraints --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Март 2012<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Имя автора<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>автор@домен.рф<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>http://домен.рф<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Copyright Info<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Лицензия<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!--  The version string is recorded in the components table --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>0.0.8<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- The description is optional and defaults to the name --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD_DESCRIPTION<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;install<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on install --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;file</span> <span style="color: #000066;">driver</span>=<span style="color: #ff0000;">"mysql"</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">"utf8"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/install.mysql.utf8.sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/file<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/install<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;uninstall<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on uninstall --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;file</span> <span style="color: #000066;">driver</span>=<span style="color: #ff0000;">"mysql"</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">"utf8"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/uninstall.mysql.utf8.sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/file<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/uninstall<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;update<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on update; New in 2.5 --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;schemas<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;schemapath</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"mysql"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/updates/mysql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/schemapath<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/schemas<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/update<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- Site Main File Copy Section --&gt;</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- Note the folder attribute: This attribute describes the folder</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">		to copy FROM in the package to install therefore files copied</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">		in this section are copied from /site/ in the package --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"site"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>helloworld.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>controller.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>views<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>models<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>language<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;administration<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #808080;">&lt;!-- Administration Menu Section --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD_MENU<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #808080;">&lt;!-- Administration Main File Copy Section --&gt;</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #808080;">&lt;!-- Note the folder attribute: This attribute describes the folder</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">			to copy FROM in the package to install therefore files copied</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">			in this section are copied from /admin/ in the package --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"admin"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- Admin Main File Copy Section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>helloworld.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>controller.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- SQL files section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- tables files section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>tables<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- models files section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>models<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- views files section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>views<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;languages</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"admin"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"en-GB"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/en-GB/en-GB.com_helloworld.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"en-GB"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/en-GB/en-GB.com_helloworld.sys.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"ru-RU"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/ru-RU/ru-RU.com_helloworld.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;language</span> <span style="color: #000066;">tag</span>=<span style="color: #ff0000;">"ru-RU"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>language/ru-RU/ru-RU.com_helloworld.sys.ini<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/language<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/languages<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/administration<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/extension<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Языковые файлы будут установлены и располагаться по следующему пути:</p>
<ul>
<li><span style="color: #0000ff;">administrator/language</span> для интерфейса администратора</li>
<li><span style="color: #0000ff;">components/com_helloworld/language</span> для интерфейса пользователя</li>
</ul>
<p>Создайте архив с компонентом, установите его на сайт.</p>
<p><a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part08.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать архив для этой части курса</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 21 Mar 2012 10:11:02 +0000</pubDate>
		</item>
		<item>
			<title>Шаг 8. Сохранение данных в БД</title>
			<link>http://tungusov.ru/step8.html</link>
			<guid>http://tungusov.ru/step8.html</guid>
			<description><![CDATA[<h1>Шаг 8. Сохранение данных в БД<br /></h1>
<p>После того как мы ввели данные в форму, при нажатии на кнопку "Сохранить", мы должны сохранить введенные данные в таблице БД. Для этого создадим функцию <span style="font-family: courier new,courier;"><span style="color: #0000ff;">saveGoodtime()</span> </span>в файле <span style="font-family: courier new,courier; color: #0000ff;">admin.goodtimes.php</span></p>

<h1>Шаг 8. Сохранение данных в БД<br /></h1>
<p>После того как мы ввели данные в форму, при нажатии на кнопку "Сохранить", мы должны сохранить введенные данные в таблице БД. Для этого создадим функцию <span style="font-family: courier new,courier;"><span style="color: #0000ff;">saveGoodtime()</span> </span>в файле <span style="font-family: courier new,courier; color: #0000ff;">admin.goodtimes.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody style="text-align: left;">
<tr style="text-align: left;" class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: left;">
<pre style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; vertical-align: top; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br /></pre>
</td>
<td style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; vertical-align: top; font-size: 12px; text-align: left;">
<pre style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; vertical-align: top; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">function</span> saveGoodtime<span style="color: #009900;">(</span> <span style="color: #000088;">$option</span> <span style="color: #009900;">)</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">	<span style="color: #990000;">global</span> <span style="color: #000088;">$mainframe</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span> <span style="color: #339933;">=&</span> JTable<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'goodtimes'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Table'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bind</span><span style="color: #009900;">(</span>JRequest<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'post'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #990000;">echo</span> <span style="color: #0000ff;">"&lt;script&gt; alert('"</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"'); window.history.go(-1); &lt;/script&gt;<span style="font-weight: bold; color: #000099;">\n</span>"</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">		<span style="color: #990000;">exit</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">review</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getVar</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'review'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span> JREQUEST_ALLOWRAW <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">smoking</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">smoking</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$date</span> <span style="color: #339933;">=&</span> JFactory<span style="color: #339933;">::</span><span style="color: #990000;">getDate</span><span style="color: #009900;">(</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">review_date</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">review_date</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$date</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">toMySQL</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">store</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #990000;">echo</span> <span style="color: #0000ff;">"&lt;script&gt; alert('"</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"'); window.history.go(-1); &lt;/script&gt;<span style="font-weight: bold; color: #000099;">\n</span>"</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">		<span style="color: #990000;">exit</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">switch</span> <span style="color: #009900;">(</span><span style="color: #000088;">$task</span><span style="color: #009900;">)</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'apply'</span><span style="color: #339933;">:</span></span><br /><span style="vertical-align: top;">			<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Изменения в обзоре сохранены.'</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">			<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'index.php?option='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$option</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&task=edit&cid[]='</span><span style="color: #339933;">.</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">		<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'save'</span><span style="color: #339933;">:</span></span><br /><span style="vertical-align: top;">		<span style="font-weight: bold; color: #000000;">default</span><span style="color: #339933;">:</span></span><br /><span style="vertical-align: top;">			<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Обзор сохранен.'</span><span style="color: #339933;">;</span> </span><br /><span style="vertical-align: top;">			<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'index.php?option='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$option</span><span style="color: #339933;">;</span> </span><br /><span style="vertical-align: top;">			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span> </span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$mainframe</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">(</span><span style="color: #000088;">$link</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msg</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Для начала мы объявляем глобальную переменную <span style="font-family: courier new,courier; color: #0000ff;">$mainframe</span> и текущее сооединение с БД.  У переменной <span style="font-family: courier new,courier; color: #0000ff;">$mainframe</span> есть много функций которые мы можем использовать для того чтобы управлять сессией, переменными и заголовками. Также мы создаем <span style="font-family: courier new,courier; color: #0000ff;">$row</span> как экземпляр нашего класса <span style="font-family: courier new,courier; color: #0000ff;">Tablegoodtimes</span>. Далее функция <span style="font-family: courier new,courier; color: #0000ff;">bind()</span> загружает в <span style="font-family: courier new,courier; color: #0000ff;">$row</span> все переменные формы.</p>
Если функция<span style="font-family: courier new,courier; color: #0000ff;"> bind() </span>выдает ошибку, то мы выводим предупреждение и возвращаем пользователя к предыдущему шагу.
<p>После того как переменные формы загружены в массив<span style="font-family: courier new,courier; color: #0000ff;"> $row</span> мы можем использовать их, далее мы подготавливаем их для записи в БД.</p>
<p>Далее используя функцию <span style="font-family: courier new,courier; color: #0000ff;">store()</span> мы обновляем или же вставляем запись в БД. Здесь т.к. у нас нет значения <span style="font-family: courier new,courier; color: #0000ff;">id </span>то у нас происходит вставка новой записи.</p>
<p>Если происходит ошибка в запросе SQL, то мы выдаем эту ошибку и возвращаем пользователя на шаг назад.</p>
<p>Для того чтобы наша функция сохранения стала работать нужно в файл <span style="font-family: courier new,courier; color: #0000ff;">admin.goodtimes.php </span>в оператор<span style="font-family: courier new,courier;"> switch() </span>добавить строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody style="text-align: left;">
<tr style="text-align: left;" class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: left;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br /></pre>
</td>
<td style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; vertical-align: top; font-size: 12px; text-align: left;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'save'</span><span style="color: #339933;">:</span></span><br /><span style="vertical-align:top">	saveGoodtime<span style="color: #009900;">(</span> <span style="color: #000088;">$option</span><span style="color: #339933;">,</span> <span style="color: #000088;">$task</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Теперь откройте адрес <span style="font-family: courier new,courier; color: #0000ff;">http://ваш_сайт/administrator/index.php?option=com_goodtimes&task=add</span>, заполните все поля формы и нажмите кнопку "Сохранить".</p>
<p>На экране вы увидите следующее:</p>
<p style="text-align: center;"><a rel="lightbox[]" target="_blank" title="Шаг 8" href="http://tungusov.ru/images/stories/goodtimes/step8/1.jpg"><img ilo-full-src="http://www.tungusov.ru/images/stories/goodtimes/step8/1_thumb.jpg" alt="step8" src="http://tungusov.ru/images/stories/goodtimes/step8/1_thumb.jpg" width="200" height="69" /></a></p>
<p>Убедиться что данные сохранены в БД вы можете открыв phpMyAdmin и просмотреть таблицу <span style="font-family: courier new,courier; color: #0000ff;">jos_goodtimes</span>.</p>
<p style="text-align: center;"><a rel="lightbox[]" target="_blank" title="Шаг 8" href="http://tungusov.ru/images/stories/goodtimes/step8/2.jpg"><img ilo-full-src="http://www.tungusov.ru/images/stories/goodtimes/step8/2_thumb.jpg" alt="step8" src="http://tungusov.ru/images/stories/goodtimes/step8/2_thumb.jpg" width="200" height="31" /></a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Sat, 03 Oct 2009 03:48:55 +0000</pubDate>
		</item>
		<item>
			<title>Шаг 7. Создание формы для создания и редактирования обзоров</title>
			<link>http://tungusov.ru/step7.html</link>
			<guid>http://tungusov.ru/step7.html</guid>
			<description><![CDATA[<h1>Шаг 7. Создание формы для создания и редактирования обзоров</h1>
<p>Для того чтобы мы могли добавлять и изменять записи в БД нам нужен дружественный интерфейс. Для этого давайте создадим форму для создания и редактирования обзоров.</p>

<h1>Шаг 7. Создание формы для создания и редактирования обзоров</h1>
<p>Для того чтобы мы могли добавлять и изменять записи в БД нам нужен дружественный интерфейс. Для этого давайте создадим форму для создания и редактирования обзоров.</p>
<p>Отделим представление HTML формы от ее логики обработки. Необходимы код для ее обработки будет находиться в файле <span style="font-family: courier new,courier; color: #0000ff;">administrator/components/com_goodtimes/admin.goodtimes.php</span>, представление ее в файле <span style="font-family: courier new,courier; color: #0000ff;">administrator/components/com_goodtimes/admin.goodtimes.html.php</span>.<br />Откройте файл <span style="font-family: courier new,courier; color: #0000ff;">admin.goodtimes.php</span> и замените весь существующий код вот этим:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody style="text-align: left;">
<tr style="text-align: left;" class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: left;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br /></pre>
</td>
<td style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; vertical-align: top; font-size: 12px; text-align: left;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span><br /><span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'_JEXEC'</span> <span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'Restricted access'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">(</span> JApplicationHelper<span style="color: #339933;">::</span><span style="color: #004000;">getPath</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'admin_html'</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">JTable<span style="color: #339933;">::</span><span style="color: #004000;">addIncludePath</span><span style="color: #009900;">(</span>JPATH_COMPONENT<span style="color: #339933;">.</span>DS<span style="color: #339933;">.</span><span style="color: #0000ff;">'tables'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="color: #b1b100;">switch</span><span style="color: #009900;">(</span><span style="color: #000088;">$task</span><span style="color: #009900;">)</span></span><br /><span style="vertical-align:top"><span style="color: #009900;">{</span></span><br /><span style="vertical-align:top">	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'add'</span><span style="color: #339933;">:</span></span><br /><span style="vertical-align:top">	editGoodtime<span style="color: #009900;">(</span> <span style="color: #000088;">$option</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="color: #009900;">}</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">function</span> editGoodtime<span style="color: #009900;">(</span> <span style="color: #000088;">$option</span> <span style="color: #009900;">)</span></span><br /><span style="vertical-align:top"><span style="color: #009900;">{</span></span><br /><span style="vertical-align:top">	<span style="color: #000088;">$row</span> <span style="color: #339933;">=&</span> JTable<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Goodtimes'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Table'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> </span><br /><span style="vertical-align:top">  <span style="color: #000088;">$lists</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="color: #000088;">$lists</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'smoking'</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> JHTML<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'select.booleanlist'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'smoking'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'class="inputbox"'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">smoking</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="color: #000088;">$lists</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'published'</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> JHTML<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'select.booleanlist'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'published'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'class="inputbox"'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">published</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top">  HTML_goodtimes<span style="color: #339933;">::</span><span style="color: #004000;">editGoodtime</span><span style="color: #009900;">(</span><span style="color: #000088;">$row</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lists</span><span style="color: #339933;">,</span> <span style="color: #000088;">$option</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="color: #009900;">}</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>После проверки, что этот файл вызван в пределах Joomla, мы используем <span style="font-family: courier new,courier; color: #0000ff;">require_once (JApplicationHelper:: getPath ('admin_html'))</span> чтобы подключить файл <span style="font-family: courier new,courier; color: #0000ff;">admin.goodtimes.html.php</span>.</p>
<p>Хотя мы не будем работать с БД сразу, но мы все равно включаем класс нашей таблице строкой:  <span style="font-family: courier new,courier; color: #0000ff;">JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');</span></p>
<p>Здесь <span style="font-family: courier new,courier; color: #0000ff;">JPATH_COMPONENT</span> – это абсолютный путь до нашего компонента в административной части, <span style="font-family: courier new,courier; color: #0000ff;">DS</span> – автоматически поставит слеш в нужную сторону в зависимости от операционной системы.</p>

<p>Далее<span style="font-family: courier new,courier; color: #0000ff;"> switch()</span> проверяет переменную <span style="font-family: courier new,courier; color: #0000ff;">$task</span>, чтобы запустить нужную функцию. И наконец функция <span style="font-family: courier new,courier; color: #0000ff;">editGoodtime( )</span> готовит несколько переменных прежде чем передать их в функцию показа формы <span style="font-family: courier new,courier; color: #0000ff;">HTML_goodtimes::editGoodtime($row, $lists, $option);</span></p>
<p>Теперь создайте файл <span style="font-family: courier new,courier; color: #0000ff;">admin.goodtimes.html.php</span> и добавьте в него код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; vertical-align: top; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br /></pre>
</td>
<td style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; vertical-align: top; font-size: 12px;">
<pre style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; vertical-align: top; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span><br /><span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'_JEXEC'</span> <span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'Restricted access'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">class</span> HTML_goodtimes</span><br /><span style="vertical-align: top;"><span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">  <span style="font-weight: bold; color: #000000;">function</span> editGoodtime<span style="color: #009900;">(</span> <span style="color: #000088;">$row</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lists</span><span style="color: #339933;">,</span> <span style="color: #000088;">$option</span> <span style="color: #009900;">)</span></span><br /><span style="vertical-align: top;">  <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">    <span style="color: #000088;">$editor</span> <span style="color: #339933;">=&</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getEditor</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">?&gt;</span></span><br /><span style="vertical-align: top;">&lt;form action="index.php" method="post" </span><br /><span style="vertical-align: top;">    name="adminForm" id="adminForm"&gt;</span><br /><span style="vertical-align: top;">&lt;fieldset class="adminform"&gt;</span><br /><span style="vertical-align: top;">&lt;legend&gt;Подробности&lt;/legend&gt;</span><br /><span style="vertical-align: top;">  &lt;table class="admintable"&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Наименование:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        &lt;input class="text_area" type="text" name="name"</span><br /><span style="vertical-align: top;">          id="name" size="50" maxlength="250"</span><br /><span style="vertical-align: top;">          value="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>" /&gt;</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Адрес:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        &lt;input class="text_area" type="text" name="address"</span><br /><span style="vertical-align: top;">          id="address" size="50" maxlength="250"</span><br /><span style="vertical-align: top;">          value="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">address</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>" /&gt;</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Отзыв:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        <span style="font-weight: bold; color: #000000;">&lt;?php</span></span><br /><span style="vertical-align: top;">          <span style="color: #990000;">echo</span> <span style="color: #000088;">$editor</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'review'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">review</span> <span style="color: #339933;">,</span></span><br /><span style="vertical-align: top;">            <span style="color: #0000ff;">'100%'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'250'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'40'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'10'</span> <span style="color: #009900;">)</span> <span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">        <span style="font-weight: bold; color: #000000;">?&gt;</span></span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Примечание:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        &lt;textarea class="text_area" cols="20" rows="4"</span><br /><span style="vertical-align: top;">          name="notes" id="notes" style="width:500px"&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span></span><br /><span style="vertical-align: top;">          <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">notes</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/textarea&gt;</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Курить:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        <span style="font-weight: bold; color: #000000;">&lt;?php</span></span><br /><span style="vertical-align: top;">          <span style="color: #990000;">echo</span> <span style="color: #000088;">$lists</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'smoking'</span><span style="color: #009900;">]</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">        <span style="font-weight: bold; color: #000000;">?&gt;</span></span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Кредитная карта:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        &lt;input class="text_area" type="text" name="credit_cards"</span><br /><span style="vertical-align: top;">          id="credit_cards" size="50" maxlength="250"</span><br /><span style="vertical-align: top;">          value="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">credit_cards</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>" /&gt;</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Дата:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHTML<span style="color: #339933;">::</span><span style="color: #004000;">calendar</span><span style="color: #009900;">(</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">review_date</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'review_date'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'review_date'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">    &lt;tr&gt;</span><br /><span style="vertical-align: top;">      &lt;td width="100" align="right" class="key"&gt;</span><br /><span style="vertical-align: top;">        Публикация:</span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">      &lt;td&gt;</span><br /><span style="vertical-align: top;">        <span style="font-weight: bold; color: #000000;">&lt;?php</span></span><br /><span style="vertical-align: top;">          <span style="color: #990000;">echo</span> <span style="color: #000088;">$lists</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'published'</span><span style="color: #009900;">]</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">        <span style="font-weight: bold; color: #000000;">?&gt;</span></span><br /><span style="vertical-align: top;">      &lt;/td&gt;</span><br /><span style="vertical-align: top;">    &lt;/tr&gt;</span><br /><span style="vertical-align: top;">  &lt;/table&gt;</span><br /><span style="vertical-align: top;">&lt;/fieldset&gt;</span><br /><span style="vertical-align: top;">  &lt;input type="hidden" name="id" value="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>" /&gt;</span><br /><span style="vertical-align: top;">  &lt;input type="hidden" name="option" value="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$option</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>" /&gt;</span><br /><span style="vertical-align: top;">  &lt;input type="hidden" name="task" value="" /&gt;</span><br /><span style="vertical-align: top;">&lt;/form&gt;</span><br /><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span><br /><span style="vertical-align: top;">  <span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">?&gt;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Теперь перейдите по адресу: <span style="font-family: courier new,courier; color: #0000ff;">http://ваш_сайт/administrator/index.php?option=com_goodtimes&task=add</span>, вы должны увидеть следующее:</p>
<p style="text-align: center;"><a rel="lightbox[]" target="_blank" title="Шаг 7" href="http://tungusov.ru/images/stories/goodtimes/step7/1.jpg"><img ilo-full-src="http://www.tungusov.ru/images/stories/goodtimes/step7/1_thumb.jpg" alt="Шаг 7" src="http://tungusov.ru/images/stories/goodtimes/step7/1_thumb.jpg" height="230" width="300" /></a></p>
<p> </p>
<p>Здесь наша функция <span style="font-family: courier new,courier; color: #0000ff;">editGoodtime()</span> берет ряды таблицы БД и отображает эту форму, т.е. эта функция полностью отвечает за отображение этой формы.<br />Функция <span style="font-family: courier new,courier; color: #0000ff;">JFactory::getEditor();</span> служит для отображения окна редактора.</p>
<p><a class="jce_file" title="Скачатьисходный код примера" href="http://tungusov.ru/images/stories/files/goodtimes/step7.zip"> <img ilo-full-src="http://www.tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачатьисходный код примера</a></p>
<a href="http://www.tungusov.ru/createcomponentsjoomla15/222-step7.html?start=1" style="display: none;">страница 2</a>
<a href="http://www.tungusov.ru/step7.html?start=1" style="display: none;">страница 3</a>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 30 Sep 2009 03:21:42 +0000</pubDate>
		</item>
		<item>
			<title>Шаг 6. Создание Класса Таблицы БД</title>
			<link>http://tungusov.ru/step6.html</link>
			<guid>http://tungusov.ru/step6.html</guid>
			<description><![CDATA[<h1>Шаг 6. Создание Класса Таблицы БД</h1>
<p>Мы могли бы написать собственные функции, для того чтобы добавлять, обновлять, и удалять записи из таблицы БД. Но в Joomla! уже существует класс JTable обеспечивающий функции для работы с базой данных. Чтобы использовать JTable, мы должны написать расширение для нашего компонента.</p>

<h1>Шаг 6. Создание Класса Таблицы БД</h1>
<p>Мы могли бы написать собственные функции, для того чтобы добавлять, обновлять, и удалять записи из таблицы БД. Но в Joomla! уже существует класс JTable обеспечивающий функции для работы с базой данных. Чтобы использовать JTable, мы должны написать расширение для нашего компонента.</p>
<p>В папке <span style="font-family: courier new,courier; color: #0000ff;">administrator/components/com_goodtimes</span>, создадим папку <span style="font-family: courier new,courier; color: #0000ff;">tables</span>. В этой папке, создайте файл <span style="font-family: courier new,courier; color: #0000ff;">goodtimes.php</span> и добавьте в него следующий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> TableGoodtimes <span style="font-weight: bold; color: #000000;">extends</span> JTable</span><br /><span style="vertical-align:top"><span style="color: #009900;">{</span></span><br /><span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$address</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$review</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$notes</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$smoking</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$credit_cards</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$review_date</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">  <span style="font-weight: bold; color: #000000;">var</span> <span style="color: #000088;">$published</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> __construct<span style="color: #009900;">(</span><span style="color: #339933;">&</span><span style="color: #000088;">$db</span><span style="color: #009900;">)</span></span><br /><span style="vertical-align:top">	<span style="color: #009900;">{</span></span><br /><span style="vertical-align:top">		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">(</span> <span style="color: #0000ff;">'#__goodtimes'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align:top"><span style="color: #009900;">}</span></span><br /><span style="vertical-align:top"> </span><br /><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Когда мы расширяем класс JTable, мы добавляем все колонки таблицы базы данных как переменные и устанавливаем их значения в null. Также мы создаем свой конструктор, не используя конструктор класса. В минимуме наш метод <span style="font-family: courier new,courier; color: #0000ff;">__construct ()</span> возьмет объект базы данных как параметр и вызовет родительский конструктор, использующего имя таблицы базы данных (где<span style="font-family: courier new,courier; color: #0000ff;"> # __</span> является префиксом таблицы), первичный ключ, и объект базы данных.</p>
<p>{simpleaccordion}Title 1::<strong>Text 1.</strong>||||<strong>Title 2</strong>::Text 2.{/simpleaccordion}</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 30 Sep 2009 03:08:06 +0000</pubDate>
		</item>
		<item>
			<title>Шаг 5. Создание Таблицы Базы данных</title>
			<link>http://tungusov.ru/step5.html</link>
			<guid>http://tungusov.ru/step5.html</guid>
			<description><![CDATA[<h1>Шаг 5. Создание Таблицы Базы данных</h1>
<p>Прежде, чем мы настроим интерфейс для того, чтобы редактировать и добавлять обзоры, мы должны создать таблицу в базе данных, где они будут храниться.</p>

<h1>Шаг 5. Создание Таблицы Базы данных</h1>
<p>Прежде, чем мы настроим интерфейс для того, чтобы редактировать и добавлять обзоры, мы должны создать таблицу в базе данных, где они будут храниться.</p>
<p>В веди следующий SQL запрос в консоле:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_sql">
<table class="sql" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody style="text-align: left;">
<tr style="text-align: left;" class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: left;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></pre>
</td>
<td style="margin: 0pt; padding: 0px 4px; background: transparent none repeat scroll 0% 0%; vertical-align: top; font-size: 12px; text-align: left;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">CREATE</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">'jos_goodtimes'</span></span><br /><span style="vertical-align:top"><span style="color: #66cc66;">(</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'id'</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'name'</span> varchar<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'address'</span> varchar<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'review'</span> text <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'notes'</span> text <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'smoking'</span> tinyint<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">UNSIGNED</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'credit_cards'</span> varchar<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'review_date'</span> datetime <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="color: #ff0000;">'published'</span> tinyint<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">UNSIGNED</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span></span><br /><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">PRIMARY</span> <span style="font-weight: bold; color: #993333;">KEY</span> <span style="color: #66cc66;">(</span><span style="color: #ff0000;">'id'</span><span style="color: #66cc66;">)</span></span><br /><span style="vertical-align:top"><span style="color: #66cc66;">)</span>;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Или используя phpMyAdmin, создайте новую таблицу в базе данных <span style="font-family: courier new,courier; color: #0000ff;">jos_goodtimes</span>, c девятью полями:</p>
<p style="text-align: center;"><a rel="lightbox[step5]" target="_blank" title="Шаг 5" href="http://tungusov.ru/images/stories/goodtimes/step5/1.jpg"><img ilo-full-src="http://www.tungusov.ru/images/stories/goodtimes/step5/1_thumb.jpg" alt="Шаг 5" src="http://tungusov.ru/images/stories/goodtimes/step5/1_thumb.jpg" width="200" height="244" /></a></p>
<p style="text-align: center;"><a rel="lightbox[step5]" target="_blank" title="Шаг 5" href="http://tungusov.ru/images/stories/goodtimes/step5/2.jpg"><img ilo-full-src="http://www.tungusov.ru/images/stories/goodtimes/step5/2_thumb.jpg" alt="Шаг 5" src="http://tungusov.ru/images/stories/goodtimes/step5/2_thumb.jpg" width="386" height="150" /></a></p>
<p>После того как все поля заполнены, нажмите «Сохранить».</p>
<p>Таблица БД создана.</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 30 Sep 2009 02:45:14 +0000</pubDate>
		</item>
		<item>
			<title>Создание файла сценария установки/удаления/обновления</title>
			<link>http://tungusov.ru/addinganinstall-uninstall-updatescriptfile.html</link>
			<guid>http://tungusov.ru/addinganinstall-uninstall-updatescriptfile.html</guid>
			<description><![CDATA[<p>При установке, обновлении или удалении компонента могут потребоваться дополнительные операции, которые не обеспечиваются основными операциями, описанными в основном файле xml. &nbsp;</p>
<p>Joomla! предлагает новый подход к решению этой проблемы. Он заключается в использовании файла сценария, содержащего класс с именем вида <span style="color: #0000ff;">com_ИмяКомпонентаInstallerScript</span>, в котором используются пять методов:</p>
<ul>
<li><span style="color: #0000ff;">preflight</span>, выполняется перед установкой или обновлением</li>
<li><span style="color: #0000ff;">install</span></li>
<li><span style="color: #0000ff;">update</span></li>
<li><span style="color: #0000ff;">uninstall</span></li>
<li><span style="color: #0000ff;">postflight</span>, который выполняется после установки и обновления.</li>
</ul>
<p>Создайте файл <span style="color: #0000ff;">script.php</span> со следующим кодом:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php" style="overflow: auto; width: 100%; height: auto; border: 1px solid #054b6e; background: #f8f8f8;">
<div class="php" style="border-collapse: collapse; width: 100%;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></span>
<span style="vertical-align: top;"><span style="color: #666666; font-style: italic;">// No direct access to this file</span></span>
<span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">&nbsp;</span>
<span style="vertical-align: top;"><span style="color: #009933; font-style: italic;">/**</span> <span style="vertical-align: top;"> * Script file of HelloWorld component</span> <span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"><span style="color: #000000; font-weight: bold;">class</span> com_helloWorldInstallerScript</span>
<span style="vertical-align: top;"><span style="color: #009900;">{</span></span>
<span style="vertical-align: top;"> <span style="color: #009933; font-style: italic;">/**</span> <span style="vertical-align: top;"> * method to install the component</span> <span style="vertical-align: top;"> *</span> <span style="vertical-align: top;"> * @return void</span> <span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"> <span style="color: #000000; font-weight: bold;">function</span> install<span style="color: #009900;">(</span><span style="color: #000088;">$parent</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;"> <span style="color: #009900;">{</span></span>
<span style="vertical-align: top;"> <span style="color: #666666; font-style: italic;">// $parent is the class calling this method</span></span>
<span style="vertical-align: top;"> <span style="color: #000088;">$parent</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParent</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRedirectURL</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'index.php?option=com_helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">&nbsp;</span>
<span style="vertical-align: top;"> <span style="color: #009933; font-style: italic;">/**</span> <span style="vertical-align: top;"> * method to uninstall the component</span> <span style="vertical-align: top;"> *</span> <span style="vertical-align: top;"> * @return void</span> <span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"> <span style="color: #000000; font-weight: bold;">function</span> uninstall<span style="color: #009900;">(</span><span style="color: #000088;">$parent</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;"> <span style="color: #009900;">{</span></span>
<span style="vertical-align: top;"> <span style="color: #666666; font-style: italic;">// $parent is the class calling this method</span></span>
<span style="vertical-align: top;"> <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span> <span style="color: #339933;">.</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_UNINSTALL_TEXT'</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">&nbsp;</span>
<span style="vertical-align: top;"> <span style="color: #009933; font-style: italic;">/**</span> <span style="vertical-align: top;"> * method to update the component</span> <span style="vertical-align: top;"> *</span> <span style="vertical-align: top;"> * @return void</span> <span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"> <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #009900;">(</span><span style="color: #000088;">$parent</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;"> <span style="color: #009900;">{</span></span>
<span style="vertical-align: top;"> <span style="color: #666666; font-style: italic;">// $parent is the class calling this method</span></span>
<span style="vertical-align: top;"> <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span> <span style="color: #339933;">.</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_UPDATE_TEXT'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parent</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'manifest'</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">version</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">&nbsp;</span>
<span style="vertical-align: top;"> <span style="color: #009933; font-style: italic;">/**</span> <span style="vertical-align: top;"> * method to run before an install/update/uninstall method</span> <span style="vertical-align: top;"> *</span> <span style="vertical-align: top;"> * @return void</span> <span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"> <span style="color: #000000; font-weight: bold;">function</span> preflight<span style="color: #009900;">(</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parent</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;"> <span style="color: #009900;">{</span></span>
<span style="vertical-align: top;"> <span style="color: #666666; font-style: italic;">// $parent is the class calling this method</span></span>
<span style="vertical-align: top;"> <span style="color: #666666; font-style: italic;">// $type is the type of change (install, update or discover_install)</span></span>
<span style="vertical-align: top;"> <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span> <span style="color: #339933;">.</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_PREFLIGHT_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'_TEXT'</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">&nbsp;</span>
<span style="vertical-align: top;"> <span style="color: #009933; font-style: italic;">/**</span> <span style="vertical-align: top;"> * method to run after an install/update/uninstall method</span> <span style="vertical-align: top;"> *</span> <span style="vertical-align: top;"> * @return void</span> <span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"> <span style="color: #000000; font-weight: bold;">function</span> postflight<span style="color: #009900;">(</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parent</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;"> <span style="color: #009900;">{</span></span>
<span style="vertical-align: top;"> <span style="color: #666666; font-style: italic;">// $parent is the class calling this method</span></span>
<span style="vertical-align: top;"> <span style="color: #666666; font-style: italic;">// $type is the type of change (install, update or discover_install)</span></span>
<span style="vertical-align: top;"> <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span> <span style="color: #339933;">.</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_POSTFLIGHT_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'_TEXT'</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Этот скрипт после установки будет направлять пользователя в наш компонент <span style="color: #0000ff;">com_helloworld</span>, а при обновлении или удалении – выводить соответствующее сообщение. При обновлении мы показываем новую версию, используя <span style="color: #0000ff;">$parent-&gt;get('manifest')-&gt;version</span>.</p>
<p>Измените языковые файлы:</p>
<p><span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.sys.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini" style="overflow: auto; width: 100%; height: auto; border: 1px solid #054b6e; background: #f8f8f8;">
<div class="ini" style="border-collapse: collapse; width: 100%;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Hello World!"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_DESCRIPTION</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"This is the Hello World description"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Hello World"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"This view displays a selected message"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MENU</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Hello World!"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld Install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_DISCOVER_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postlight discover install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postflight install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_UNINSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postflight uninstall script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_UPDATE_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postflight update script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_DISCOVER_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight discover install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_UNINSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight uninstall script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_UPDATE_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight update script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_UNINSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld Uninstall script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_UPDATE_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld Update script. HelloWorld now updated to version %s."</span></span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">&nbsp;admin/language/ru-RU/ru-RU.com_helloworld.sys.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini" style="overflow: auto; width: 100%; height: auto; border: 1px solid #054b6e; background: #f8f8f8;">
<div class="ini" style="border-collapse: collapse; width: 100%;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Привет МИР!!!"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_DESCRIPTION</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Это описание нашего компонента Привет МИР!"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Привет Мир"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Выберите вариант отображения"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MENU</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"Привет Мир!"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld Install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_DISCOVER_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postlight discover install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postflight install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_UNINSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postflight uninstall script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_POSTFLIGHT_UPDATE_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld postflight update script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_DISCOVER_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight discover install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_INSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight install script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_UNINSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight uninstall script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_PREFLIGHT_UPDATE_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld preflight update script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_UNINSTALL_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld Uninstall script"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_UPDATE_TEXT</span><span style="color: #000066; font-weight: bold;">=</span><span style="color: #933;">"HelloWorld Update script. HelloWorld now updated to version %s."</span></span></pre>
</div>
</div>
</div>
<p>В файл <span style="color: #0000ff;">helloworld.xml</span> после строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml" style="overflow: auto; width: 100%; height: auto; border: 1px solid #054b6e; background: #f8f8f8;">
<div class="xml" style="border-collapse: collapse; width: 100%;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>COM_HELLOWORLD_DESCRIPTION<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>добавьте следующие строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml" style="overflow: auto; width: 100%; height: auto; border: 1px solid #054b6e; background: #f8f8f8;">
<div class="xml" style="border-collapse: collapse; width: 100%;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #808080; font-style: italic;">&lt;!-- Runs on install/uninstall/update; New in 2.5 --&gt;</span></span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scriptfile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>script.php<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scriptfile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Создайте архив с компонентом, установите его на сайт.</p>
<p><a class="wf_file" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part15.zip"><img class="wf_file_icon" src="http://tungusov.ru/media/jce/icons/archive.png" style="border: 0px; vertical-align: middle;" alt="zip" /><span class="wf_file_text">Скачать архив для этой части курса</span></a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Tue, 14 Aug 2012 04:08:20 +0000</pubDate>
		</item>
		<item>
			<title>Создание простого компонента Привет МИР!</title>
			<link>http://tungusov.ru/create-helloworld-component.html</link>
			<guid>http://tungusov.ru/create-helloworld-component.html</guid>
			<description><![CDATA[<p>Итак, давайте создадим самый простой и любимый уже всем компонент Hello World! или Привет МИР!</p>
<h3>Интерфейс пользователя</h3>
<p>Для начала создайте у себя на компьютере папку <span style="color: #0000ff;">com_helloworld </span>, в ней создайте папку <span style="color: #0000ff;">site </span></p>
<p>Далее создайте файл <span style="color: #0000ff;">helloworld.php </span> со следующим содержимым:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">Привет МИР<span style="color: #339933;">!!!</span></span></pre>
</div>
</div>
</div>
<p>при этом кодировка файла должна быть UTF-8. Сохраните этот файл в папку <span style="color: #0000ff;">site </span></p>
<h3>Интерфейс администратора</h3>
<p>В папке <span style="color: #0000ff;">com_helloworld </span> создайте еще одну папку и назовите ее <span style="color: #0000ff;">admin </span></p>
<p>Далее создайте файл <span style="color: #0000ff;">helloworld.php </span> со следующим содержимым:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">Привет МИР<span style="color: #339933;">!</span> Администратор</span></pre>
</div>
</div>
</div>
<p>кодировка файла должна быть так же, хотя и всех других файлов тоже, UTF-8. Сохраните этот файл в папку <span style="color: #0000ff;">admin </span>.</p>
<p>Далее создадим установочный файл для нашего компонента. Для этого откройте текстовый редактор и вставьте следующий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;extension</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"component"</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"2.5.0"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"upgrade"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>com_helloworld<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- The following elements are optional and free of formatting constraints --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Март 2012<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Имя автора<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>автор@домен.рф<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>http://домен.рф<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Copyright Info<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Лицензия<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- The version string is recorded in the components table --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>0.0.1<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- The description is optional and defaults to the name --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Это простой компонент приветствия ...<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;update<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on update; New in 2.5 --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;schemas<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;schemapath</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"mysql"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/updates/mysql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/schemapath<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/schemas<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/update<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- Site Main File Copy Section --&gt;</span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- Note the folder attribute: This attribute describes the folder</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #808080;"> to copy FROM in the package to install therefore files copied</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #808080;"> in this section are copied from /site/ in the package --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"site"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>helloworld.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;administration<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- Administration Menu Section --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Привет МИР!<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- Administration Main File Copy Section --&gt;</span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- Note the folder attribute: This attribute describes the folder</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #808080;"> to copy FROM in the package to install therefore files copied</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #808080;"> in this section are copied from /admin/ in the package --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"admin"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- Admin Main File Copy Section --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>helloworld.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="font-style: italic; color: #808080;">&lt;!-- SQL files section --&gt;</span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/administration<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/extension<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Сохраните этот файл в папке <span style="color: #0000ff;">com_helloworld </span> под именем <span style="color: #0000ff;">helloworld.xml </span>.</p>
<p>Далее в папке <span style="color: #0000ff;">admin </span> создайте следующую структуру папок:</p>
<p style="text-align: center;"><img alt="001" src="http://tungusov.ru/images/stories/mvc-2.5/001.jpg" height="104" width="176" /></p>
<p>Создайте пустой файл и сохраните его в следующей папке <span style="color: #0000ff;">admin\sql\updates\mysql\ </span> под именем <span style="color: #0000ff;">0.0.1.sql </span>.</p>
<p>И наконец создайте файл со следующим содержимым:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_html4strict">
<div class="html4strict" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;">&lt;<span style="font-weight: bold; color: #000000;">html</span>&gt;&lt;<span style="font-weight: bold; color: #000000;">body</span> <span style="color: #000066;">bgcolor</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"#FFFFFF"</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="font-weight: bold; color: #000000;">body</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="font-weight: bold; color: #000000;">html</span>&gt;</span></span></pre>
</div>
</div>
</div>
<p>и сохраните его во все папки нашего компонента.</p>
<p>В папке <span style="color: #0000ff;">com_helloworld </span> у вас должна получиться следующая структура:</p>
<ul>
<li><span style="color: #800000;">helloworld.xml </span></li>
<li><span style="color: #800000;">site/helloworld.php </span></li>
<li><span style="color: #800000;">site/index.html </span></li>
<li><span style="color: #800000;">admin/index.html </span></li>
<li><span style="color: #800000;">admin/helloworld.php </span></li>
<li><span style="color: #800000;">admin/sql/index.html </span></li>
<li><span style="color: #800000;">admin/sql/updates/index.html </span></li>
<li><span style="color: #800000;">admin/sql/updates/mysql/index.html </span></li>
<li><span style="color: #800000;">admin/sql/updates/mysql/0.0.1.sql </span></li>
</ul>
<p>Теперь создайте zip архив компонента поместив в него выше перечисленные файлы и папки, назовите его <span style="color: #0000ff;">com_helloworld.zip </span>.</p>
<p>Откройте сайт, зайдите в панель администратора и установите компонент.</p>
<p>В пункте меню <strong>«Компоненты»</strong> появится ссылка на наш компонент, пройдя по которой мы увидим наш текст.</p>
<p>Также работу нашего компонента мы можем увидеть и в интерфейсе пользователя для этого откройте следующий адрес: <span style="color: #0000ff;">вашдомен.ру/index.php?option=com_helloworld </span></p>
<p>На этом пока все. Удачи!</p>
<p><a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part01.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border: 0px; vertical-align: middle;" /> Скачать архив для этой части курса</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Thu, 15 Mar 2012 08:58:22 +0000</pubDate>
		</item>
		<item>
			<title>Создание модели для интерфейса пользователя</title>
			<link>http://tungusov.ru/create-model-for-frontend.html</link>
			<guid>http://tungusov.ru/create-model-for-frontend.html</guid>
			<description><![CDATA[<p>Модель отвечает за управление данными в компоненте.
</p>
<p>Создайте в папке 
  <span style="color: #0000ff;">site
  </span> папку models и уже в ней файл
  <span style="color: #0000ff;"> helloworld.php
  </span> со следующим содержимым:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_php">
    <div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla modelitem library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.modelitem'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld Model</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldModelHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JModelItem</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * @var string msg</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="color: #000088;">$msg</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Get the message</span>
<span style="vertical-align:top">	 * @return string The message to be displayed to the user</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> getMsg<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Привет МИР! Говорит модель :)'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
    </div>
  </div>
</div>
<p>здесь функция 
  <span style="color: #0000ff;">getMsg 
  </span>возвращает данные тому кто ее вызвал.
</p>
<p>Так же не забывайте скопировать файл 
  <span style="color: #0000ff;">index.html
  </span> в папку 
  <span style="color: #0000ff;">models
  </span> и вообще в каждой папке компонента, модуля или плагина должен присутствовать этот файл, для защиты директории от листинга файлов.
</p>
<p>Далее открой те файл 
  <span style="color: #0000ff;">site/views/helloworld/view.html.php
  </span> и замените в нем код на этот:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_php">
    <div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HTML View class for the HelloWorld Component</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #666666;">// Overwriting JView display method</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Assign data to the view</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Msg'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Display the view</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
    </div>
  </div>
</div>
<p>здесь класс 
  <span style="color: #0000ff;">HelloWorldViewHelloWorld
  </span> запрашивает данные у модели методом 
  <span style="color: #0000ff;">get
  </span> класса 
  <span style="color: #0000ff;">JView
  </span>.
</p>
<p>Также отредактируйте файл 
  <span style="color: #0000ff;">helloworld.xml
  </span>, где укажите версию компонента 0.0.4 и в секцию 
  <span style="color: #0000ff;">&lt;files folder="site"&gt;
  </span> добавьте следующий код:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_xml">
    <div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>models<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
    </div>
  </div>
</div>
<p>это объявление говорит о том, что у нас добавилась еще одна папка.
</p>
<p>Создайте архив с компонентом, установите его на сайт и проверьте работоспособность используя ссылку в меню в интерфейсе пользователя.
</p>
<p>
  <a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part04.zip"> 
    <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать архив для этой части курса</a>
</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Fri, 16 Mar 2012 08:04:58 +0000</pubDate>
		</item>
		<item>
			<title>Создание контент плагина (content plugin) для CMS Joomla! 1.5 «Простой аккордеон». - Начало</title>
			<link>http://tungusov.ru/create-plugin-simple-accordion-step0.html</link>
			<guid>http://tungusov.ru/create-plugin-simple-accordion-step0.html</guid>
			<description><![CDATA[<p>Для начала что же это за зверь такой <strong>плагин (plugin)</strong>.</p>
<blockquote><strong><span class="open">П</span>лагин</strong> (от англ. plug-in) — независимо компилируемый <strong>программный модуль</strong>, динамически подключаемый к основной программе, предназначенный для расширения и/или использования её возможностей. Плагины обычно выполняются в виде разделяемых библиотек. <strong>Плагин - это маленькая программка</strong>, которая встраивается в основную (большую) программу и расширяет её возможности.
<div><br />Плагины позволяют нам редактировать функциональность системы, без непосредственного редактирования существующего кода. Например, плагин можно использовать для обработки контента, перед выводом его на экран, расширить возможности поиска, или создать свой механизм авторизаци<span class="close">и.</span></div>
</blockquote>

<p>В этом уроке мы рассмотрим <strong>создание плагина «Простой аккордеон»</strong>, который при встрече в статье следующих строк:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_abap">
<table class="abap" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
3
4
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #66cc66;">{</span>simpleaccordion<span style="color: #66cc66;">}</span>Title <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">::</span> <span style="color: #202020;">Lorem</span> ipsum dolor sit amet, consectetur adipiscing elit. placerat..</span>
<span style="vertical-align:top">||||</span>
<span style="vertical-align:top">Title <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">::</span> <span style="color: #202020;">Lorem</span> ipsum dolor sit amet, consectetur adipiscing elit. <span style="color: #202020;">Sed</span> malesuada, pretium leo eu placerat..</span>
<span style="vertical-align:top"><span style="color: #66cc66;">{</span><span style="color: #66cc66;">/</span>simpleaccordion<span style="color: #66cc66;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>заменит их на что то подобное (кликните по титлу):</p>
<p>{simpleaccordion}Title 1:: Lorem ipsum dolor sit amet, consectetur  adipiscing elit. Sed malesuada, nisi eget eleifend pharetra, eros mi  blandit nibh, eu posuere arcu orci vitae felis. Nam blandit pretium leo  eu placerat..<br /> ||||<br /> Title 2:: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed  malesuada, nisi eget eleifend pharetra, eros mi blandit nibh, eu posuere  arcu orci vitae felis. Nam blandit pretium leo eu placerat..<br /> {/simpleaccordion}</p>
<p>Назовем наш будущий плагин как: <strong>simpleaccordion</strong>.</p>
<p><strong>Структура конент плагина «Простейший аккордеон» </strong></p>
<p>Наш плагин будет состоять всего лишь из 2х файлов это:</p>
<ul>
<li><strong>simpleaccordion.xml</strong></li>
<li><strong>simpleaccordion.php</strong></li>
</ul>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 14 Dec 2011 08:53:08 +0000</pubDate>
		</item>
		<item>
			<title>Пользователи в Joomla! 1.5 Права пользователей в Joomla! 1.5</title>
			<link>http://tungusov.ru/the-rights-of-users-in-joomla-15.html</link>
			<guid>http://tungusov.ru/the-rights-of-users-in-joomla-15.html</guid>
			<description><![CDATA[<p>В <strong>CMS Joomla! 1.5</strong> существует <em>8 групп пользователей</em> и они все базовые. Давайте разберемся в <em>группах</em>, <em>пользователях</em>, в их <em>правах</em> и прочее. Ниже приведена разъяснительная таблица <strong>групп</strong> и <strong>прав пользователей</strong>, по моему мнению она проста для понимания.</p>
<table class="allvideo" style="width: auto;">
<caption>
<h2>Joomla ACL</h2>
</caption> <thead style="text-align: center;"> 
<tr style="text-align: center;">
<td style="text-align: center;"></td>
<th style="text-align: center;" colspan="5">
<div style="text-align: center;">Группа пользователей<br /></div>
<div style="text-align: center;">лицевая часть сайта</div>
</th> <th style="text-align: center;" colspan="3">Группа пользователей<br />административная часть сайта</th>
</tr>
<tr style="text-align: center;">
<td style="text-align: center;"></td>
<th style="text-align: center;">
<div style="text-align: center;">Un-registered<br /></div>
<div style="text-align: center;">(Не зарегистрирован)</div>
</th> <th style="text-align: center;">
<div style="text-align: center;">Registered<br /></div>
(Зарегистрирован)</th><th style="text-align: center;">Author<br />(Автор)</th> <th style="text-align: center;">Editor<br />(Редактор)</th> <th style="text-align: center;">Publisher<br />(Управляющий)</th> <th style="text-align: center;">Manager<br />(Менеджер)</th> <th style="text-align: center;">Administrator<br />(Администратор)</th> <th style="text-align: center;">Super-Administrator<br />(Супер Администратор)</th>
</tr>
</thead> 
<tbody style="text-align: center;">
<tr style="text-align: center;">
<th style="text-align: left;">View "public" content<br />(Просмотр публичного контента)</th>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">View "registered" content<br />(Просмотр контента "для зарегистрированных")</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">View "special" content<br />(Просмотр "Особого" контента)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Create new content<br />(Создание нового контента)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Edit own content<br />(Редактирование своего контента)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Edit all content<br />(Редактирование любого контента)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Publish new content<br />(Публикация нового контента)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Access the Administrator page<br />(Доступ к административной части сайта)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Create new users<br />(Создание новых пользователей)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Install extensions<br />(Установка дополнительных расширений)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Change the template<br />(Смена шаблона сайта)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
</tr>
<tr style="text-align: center;">
<th style="text-align: left;">Change site settings<br />(Изменение конфигурации сайта)</th>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">-</td>
<td style="text-align: center;">Разрешено</td>
</tr>
</tbody>
</table>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Thu, 24 Mar 2011 04:18:21 +0000</pubDate>
		</item>
		<item>
			<title>Поддержка категорий</title>
			<link>http://tungusov.ru/adding-categories.html</link>
			<guid>http://tungusov.ru/adding-categories.html</guid>
			<description><![CDATA[<p>В <strong>Joomla! 2.5</strong> поддержку категорий добавить очень просто, для этого уже существует компонент <span style="color: #0000ff;">com_categories</span>.</p>
<p><strong>Обновление SQL файлов</strong></p>
<p>Для того чтобы управлять категориями, мы должны изменить структуру таблиц БД, а именно добавить поле где будет храниться <span style="color: #0000ff;">id</span> категории.</p>
<p>Откройте файл <span style="color: #0000ff;">admin/sql/install.mysql.utf8.sql</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_sql">
<div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">DROP</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="font-weight: bold; color: #993333;">IF</span> <span style="font-weight: bold; color: #993333;">EXISTS</span> <span style="color: #ff0000;">`#__helloworld`</span>;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">CREATE</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="color: #66cc66;">(</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`greeting`</span> varchar<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`catid`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #993333;">PRIMARY</span> <span style="font-weight: bold; color: #993333;">KEY</span>  <span style="color: #66cc66;">(</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">)</span></span>
<span style="vertical-align:top"><span style="color: #66cc66;">)</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">INSERT</span> <span style="font-weight: bold; color: #993333;">INTO</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="color: #66cc66;">(</span><span style="color: #ff0000;">`greeting`</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">VALUES</span></span>
<span style="vertical-align:top">	<span style="color: #66cc66;">(</span><span style="color: #ff0000;">'Привет МИР! :) я из БД'</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">	<span style="color: #66cc66;">(</span><span style="color: #ff0000;">'Прощай МИР! :( я из БД'</span><span style="color: #66cc66;">)</span>;</span></pre>
</div>
</div>
</div>
<p>Создайте файл <span style="color: #0000ff;">admin/sql/updates/mysql/0.0.12.sql</span> с кодом:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_sql">
<div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">ALTER</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="font-weight: bold; color: #993333;">ADD</span> <span style="color: #ff0000;">`catid`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span></span></pre>
</div>
</div>
</div>
<p>Теперь сообщение может принадлежать какой либо категории. Далее мы должны изменить форму редактирования.</p>
<p>Откройте фале <span style="color: #0000ff;">admin/models/forms/helloworld.xml</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;form</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">	<span style="color: #000066;">addrulepath</span>=<span style="color: #ff0000;">"/administrator/components/com_helloworld/models/rules"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"id"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"hidden"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"greeting"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">size</span>=<span style="color: #ff0000;">"40"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">class</span>=<span style="color: #ff0000;">"inputbox validate-greeting"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">validate</span>=<span style="color: #ff0000;">"greeting"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">required</span>=<span style="color: #ff0000;">"true"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">default</span>=<span style="color: #ff0000;">""</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"catid"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"category"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">extension</span>=<span style="color: #ff0000;">"com_helloworld"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">class</span>=<span style="color: #ff0000;">"inputbox"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">default</span>=<span style="color: #ff0000;">""</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">required</span>=<span style="color: #ff0000;">"true"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"0"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JOPTION_SELECT_CATEGORY<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/field<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/form<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Так же, если сообщение может принадлежать какой либо категории, то мы должны добавить название этой категории к сообщению в выпадающем списке при создании пункта меню.</p>
<p>Откройте файл <span style="color: #0000ff;">admin/models/fields/helloworld.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import the list field type</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.form.helper'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">JFormHelper<span style="color: #339933;">::</span><span style="color: #004000;">loadFieldClass</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'list'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld Form Field class for the HelloWorld component</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> JFormFieldHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JFormFieldList</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * The field type.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @var		string</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'HelloWorld'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to get a list of options for a list input.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	array		An array of JHtml options.</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> getOptions<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">(</span><span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld.id as id,greeting,#__categories.title as category,catid'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">leftJoin</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#__categories on catid=#__categories.id'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">(</span><span style="color: #009900;">(</span>string<span style="color: #009900;">)</span><span style="color: #000088;">$query</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$messages</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadObjectList</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$messages</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$messages</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$message</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">			<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$options</span><span style="color: #009900;">[</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'select.option'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeting</span> <span style="color: #339933;">.</span></span>
<span style="vertical-align:top">				                      <span style="color: #009900;">(</span><span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">catid</span> ? <span style="color: #0000ff;">' ('</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">category</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">')'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">(</span>parent<span style="color: #339933;">::</span><span style="color: #004000;">getOptions</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$options</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Теперь название категории будет находиться в скобках после сообщения.</p>
<p><strong>Создание дочернего меню</strong></p>
<p>Компонент <span style="color: #0000ff;">com_categories</span> позволяет добавить подменю на страницу нашего компонента.</p>
<p>Откройте и создайте файл <span style="color: #0000ff;">admin/helpers/helloworld.php</span> содержащий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld component helper.</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top">abstract <span style="font-weight: bold; color: #000000;">class</span> HelloWorldHelper</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Configure the Linkbar.</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="color: #990000;">static</span> <span style="font-weight: bold; color: #000000;">function</span> addSubmenu<span style="color: #009900;">(</span><span style="color: #000088;">$submenu</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		JSubMenuHelper<span style="color: #339933;">::</span><span style="color: #004000;">addEntry</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_SUBMENU_MESSAGES'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span></span>
<span style="vertical-align:top">		                         <span style="color: #0000ff;">'index.php?option=com_helloworld'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$submenu</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'messages'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JSubMenuHelper<span style="color: #339933;">::</span><span style="color: #004000;">addEntry</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_SUBMENU_CATEGORIES'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span></span>
<span style="vertical-align:top">		                         <span style="color: #0000ff;">'index.php?option=com_categories&view=categories&extension=com_helloworld'</span><span style="color: #339933;">,</span></span>
<span style="vertical-align:top">		                         <span style="color: #000088;">$submenu</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'categories'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// set some global property</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addStyleDeclaration</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'.icon-48-helloworld '</span> <span style="color: #339933;">.</span></span>
<span style="vertical-align:top">		                               <span style="color: #0000ff;">'{background-image: url('/../media/com_helloworld/images/hello_icon48.png');}'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$submenu</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'categories'</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_ADMINISTRATION_CATEGORIES'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Этот код выполняет следующее:</p>
<ul>
<li>меняет подменю</li>
<li>меняет css стили</li>
<li>меняет заголовок браузера если выбраны категории</li>
<li>меняет заголовок компонента и показывает (скрывает) кнопки</li>
</ul>
<p>Теперь для вызова этой функции нам нужно изменить файлы <span style="color: #0000ff;">admin/controller.php</span> и <span style="color: #0000ff;">admin/helloworld.php</span>, откройте их и замените в них код на следующий:</p>
<p><span style="color: #0000ff;">admin/controller.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla controller library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.controller'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * General Controller of HelloWorld component</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldController <span style="font-weight: bold; color: #000000;">extends</span> JController</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * display task</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$cachable</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// set default view if not set</span></span>
<span style="vertical-align:top">		JRequest<span style="color: #339933;">::</span><span style="color: #004000;">setVar</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'view'</span><span style="color: #339933;">,</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getCmd</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'view'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'HelloWorlds'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// call parent behavior</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$cachable</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Set the submenu</span></span>
<span style="vertical-align:top">		HelloWorldHelper<span style="color: #339933;">::</span><span style="color: #004000;">addSubmenu</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'messages'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">admin/helloworld.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// require helper file</span></span>
<span style="vertical-align:top">JLoader<span style="color: #339933;">::</span><span style="color: #004000;">register</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'HelloWorldHelper'</span><span style="color: #339933;">,</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">(</span><span style="font-weight: bold; color: #000000;">__FILE__</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'helpers'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'helloworld.php'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import joomla controller library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.controller'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// Get an instance of the controller prefixed by HelloWorld</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$controller</span> <span style="color: #339933;">=</span> JController<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'HelloWorld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// Perform the Request task</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">(</span>JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getCmd</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'task'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// Redirect if set by the controller</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</div>
</div>
</div>
<p>Так же внесем изменения в языковые файлы:</p>
<p><span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Hello World!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Administration"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Categories"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_CREATING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Creating"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_DETAILS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Details"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_EDITING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Editing"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Some values are unacceptable"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"The category the messages belongs to"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Category"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"This message will be displayed"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Greeting"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager: Edit Message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager: New Message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLDS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_1</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"One message deleted"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_MORE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"%d messages deleted"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_MESSAGES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Messages"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Categories"</span></span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">admin/language/ru-RU/ru-RU.com_helloworld.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение для отображения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Приветствие"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Администрирование"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Категории"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_CREATING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Приветствие"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_DETAILS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Подробно"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_EDITING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Изменить"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!: Изменить сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!: Добавить сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLDS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! управление"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_1</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Одно сообщение удалено"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_MORE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"%d сообщений удалено"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Введите сообщение для отображения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Некоторые значения недопустимы"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение в категории"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Категория"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_MESSAGES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Категории"</span></span></pre>
</div>
</div>
</div>
<p>Ну и наконец в файл <span style="color: #0000ff;">helloworld.xml</span> в секцию <span style="color: #0000ff;">&lt;files folder="admin"&gt;</span> добавим строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-style: italic; color: #808080;">&lt;!-- helpers files section --&gt;</span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>helpers<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>и изменим версию на <span style="color: #0000ff;">0.0.12</span></p>
<hr />
<p>Для того что бы мы могли создавать, редактировать, удалять кактегории у нашего компонента забежим чуток вперед и добавим немного ACL для нашего компонента.</p>
<p>Создайте файл <span style="color: #0000ff;">admin/access.xml</span>, со следующим кодом:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;access</span> <span style="color: #000066;">component</span>=<span style="color: #ff0000;">"com_helloworld"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"component"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.admin"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_ADMIN"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_ADMIN_COMPONENT_DESC"</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.manage"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_MANAGE"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_MANAGE_COMPONENT_DESC"</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.create"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_CREATE"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_CREATE_COMPONENT_DESC"</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.delete"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_DELETE"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_DELETE_COMPONENT_DESC"</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.edit"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_EDIT"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_EDIT_COMPONENT_DESC"</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/section<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/access<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Об этом файле будет написано подробнее в следующих статьях.</p>
<p>В файл <span style="color: #0000ff;">helloworld.xml</span> в секцию <span style="color: #0000ff;">&lt;files folder="admin"&gt;</span> добавим строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filename<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>access.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filename<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<hr />
<p>Создайте архив с компонентом, установите его на сайт.</p>
<p><a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part12.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать архив для этой части курса</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 28 Mar 2012 09:50:02 +0000</pubDate>
		</item>
		<item>
			<title>Обзор и отзыв о Quantum System</title>
			<link>http://tungusov.ru/faq/267-quantum-system.html</link>
			<guid>http://tungusov.ru/faq/267-quantum-system.html</guid>
			<description><![CDATA[<p>Хочу всех предупредить, что <strong>эта система - ОБМАН!</strong> Некоторые читатели блога интересуются возможностями системы Quantum System.</p>
<p><img src="http://tungusov.ru/cache/13.jpg" /></p>
<p>&nbsp;Возможно ли заработать и почему о проекте Евгения Абрамова разные отзывы?</p>
<div style="text-align: left;">Отвечаю на все важные вопросы о компании, по результатам тестирования системы.</div>
<div style="text-align: left;">&nbsp;</div>
<div style="text-align: left;"><strong>1. Квантум систем – обман, развод и мошенники или нет?</strong> Мои читатели знают о моём скрупулёзном подходе к тестированию финансовых инструментов. В частности, я проверил наличие лицензии у компании, проверил наличие финансовой регуляции, бухгалтерские документы. И здесь важно сказать, что компания неоднозначна. Есть подводные камни в виде компаний мошенников, которые пытаются копировать их сайт. Существует одно официально название – Quantum System, а не Квантум Системс и подобные. Существует единственный официальный сайт. Все остальные – мошенники, у которых торговый робот не работает в 2020 году, а значит <strong>вы потеряете свои деньги</strong>.</div>
<div style="text-align: left;">&nbsp;</div>
<div style="text-align: left;"><strong>2. Почему одни получают доход, а другие ничего не зарабатывают?</strong> Ответ прост. <strong>Бесплатный сыр - только в мышеловке</strong>. Доход только получают профессионалы, но не новички ничего не делая. Проверяйте, что вы регистрируетесь на официальном сайте, а не на сайте клоне-мошеннике. Более 90% пользователей сталкиваются именно с мошенниками, после чего пишут негативные отзывы о системе.</div>
<div style="text-align: left;">&nbsp;</div>
<div style="text-align: left;"><strong>3. Я удостоверился, что я на официальном сайте. Как вывести деньги?</strong></div>
<div style="text-align: left;">Мною был проведён тест проекта, по результатам которого я убедился, что <strong>это ОБМАН<strong>.</strong></strong> Что подтверждает слова трейдерского сообщества, да и любого человека, так как регистрация абсолютна бесплатная. Главное, обращайте своё внимание на достоверность введённых данных при регистрации, не нарушайте правила. Введя ложную информацию, вы не сможете снять заработанные деньги.<strong><strong> </strong></strong></div>
<div style="text-align: left;">&nbsp;</div>
<div style="text-align: left;"><strong>4. За неделю потерял 1400$. </strong></div>
<div style="text-align: left;">Конечно, я не ожидал заработать миллион долларов, но потраченная сумма в 1400$ мне показалась большой. Тратить своё время я бы не стал, так как любой профессионал в области торговли, может заработать эти деньги за пару часов. Можно ли заработать больше? Да, но у меня не было времени и желания тестировать дальше.<strong><strong> </strong></strong></div>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Sun, 05 Jan 2020 06:43:00 +0000</pubDate>
		</item>
		<item>
			<title>Немножко приукрасим интерфейс администратора</title>
			<link>http://tungusov.ru/add-decorations-to-the-backend.html</link>
			<guid>http://tungusov.ru/add-decorations-to-the-backend.html</guid>
			<description><![CDATA[<p><strong>Использование собственных иконок </strong></p>
<div>
<p>Создайте 2 иконки для нашего приложения размером 16х16 и 48х48 пикселей и назовите их к примеру <span style="color: #0000ff;">hello_icon16.png </span>и <span style="color: #0000ff;">hello_icon48.png</span>. Сохраните их в папке <span style="color: #0000ff;">media/images/</span>.</p>
</div>
<div>
<p>В файле <span style="color: #0000ff;">helloworld.xml</span> перед строкой <span style="color: #0000ff;">&lt;administration&gt;</span> добавьте следующие строки:</p>
</div>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;media</span> <span style="color: #000066;">destination</span>=<span style="color: #ff0000;">"com_helloworld"</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"media"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align: top;">    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;">    <span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>images<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/media<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<div>
<p>замените строку</p>
</div>
<div>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD_MENU<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
</div>
<div>
<p>на</p>
</div>
<div>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;menu</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">"../media/com_helloworld/images/hello_icon16.png"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>COM_HELLOWORLD_MENU<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
</div>
<div>
<p>также сразу измените версию компонента на <span style="color: #0000ff;">0.0.10</span></p>
</div>
<div>
<p>Откройте файл <span style="color: #0000ff;">admin/views/helloworlds/view.html.php</span> и замените код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align: top;">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;"> * HelloWorlds View</span>
<span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorlds <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align: top;"><span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * HelloWorlds view display method</span>
<span style="vertical-align: top;">	 * @return void</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Get data from the model</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Items'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Pagination'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align: top;">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">		<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Assign data to the view</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$items</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pagination</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Set the toolbar</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addToolBar</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">    <span style="font-style: italic; color: #666666;">// Display the template</span></span>
<span style="vertical-align: top;">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Set the document</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * Setting the toolbar</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	protected <span style="font-weight: bold; color: #000000;">function</span> addToolBar<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">title</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLDS'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">deleteList</span><span style="color: #009900;">(</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworlds.delete'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">editList</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.edit'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">addNew</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.add'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * Method to set up the document properties</span>
<span style="vertical-align: top;">	 *</span>
<span style="vertical-align: top;">	 * @return void</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	protected <span style="font-weight: bold; color: #000000;">function</span> setDocument<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_ADMINISTRATION'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
</div>
<div>
<p>Здесь функции <span style="color: #0000ff;">JToolBarHelper::title</span> мы передаем второй параметр <span style="color: #0000ff;">helloworld</span>, это добавит к заголовку компонента css класс <span style="color: #0000ff;">helloworld</span>. Метод <span style="color: #0000ff;">_setDocument </span>служит для установки заголовка браузера.</p>
</div>
<div>
<p>Откройте файл <span style="color: #0000ff;">admin/views/helloworld/view.html.php</span> и замените код на следующий:</p>
</div>
<div>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align: top;">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;"> * HelloWorld View</span>
<span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align: top;"><span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * display method of Hello view</span>
<span style="vertical-align: top;">	 * @return void</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// get the Data</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Form'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Item'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align: top;">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">		<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Assign the Data</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Set the toolbar</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addToolBar</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Display the template</span></span>
<span style="vertical-align: top;">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Set the document</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * Setting the toolbar</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	protected <span style="font-weight: bold; color: #000000;">function</span> addToolBar<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		JRequest<span style="color: #339933;">::</span><span style="color: #004000;">setVar</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'hidemainmenu'</span><span style="color: #339933;">,</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$isNew</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">title</span><span style="color: #009900;">(</span><span style="color: #000088;">$isNew</span> ? JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align: top;">		                             <span style="color: #339933;">:</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">save</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.save'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">cancel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.cancel'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$isNew</span> ? <span style="color: #0000ff;">'JTOOLBAR_CANCEL'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'JTOOLBAR_CLOSE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * Method to set up the document properties</span>
<span style="vertical-align: top;">	 *</span>
<span style="vertical-align: top;">	 * @return void</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	protected <span style="font-weight: bold; color: #000000;">function</span> setDocument<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$isNew</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span><span style="color: #000088;">$isNew</span> ? JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_CREATING'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align: top;">		                           <span style="color: #339933;">:</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_EDITING'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Здесь мы также добавляем css класс нашему заголовку и устанавливаем заголовок браузера.</p>
</div>
<div>
<p>Откройте файл <span style="color: #0000ff;">admin/helloworld.php</span> и после строки</p>
</div>
<div>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</div>
</div>
</div>
<p>вставьте код:</p>
</div>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// Set some global property</span></span>
<span style="vertical-align: top;"><span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"><span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addStyleDeclaration</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'.icon-48-helloworld {background-image: url(\'../media/com_helloworld/images/hello_icon48.png\');}'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</div>
</div>
</div>
<div>
<p>Откройте файл <span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.ini</span> и замените код на следующий:</p>
</div>
<div>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Administration"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_CREATING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Creating"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_DETAILS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Details"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_EDITING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Editing"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"This message will be displayed"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Message"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Greeting"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager: Edit Message"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager: New Message"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLDS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_1</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"One message deleted"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_MORE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"%d messages deleted"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Message"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Enter Message"</span></span></pre>
</div>
</div>
</div>
</div>
<div>
<p>Откройте файл <span style="color: #0000ff;">admin/language/ru-RU/ru-RU.com_helloworld.ini </span>и замените код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение для отображения"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Приветствие"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Администрирование"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_CREATING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Приветствие"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_DETAILS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Подробно"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_EDITING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Изменить"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!: Изменить сообщение"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!: Добавить сообщение"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLDS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! управление"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_1</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Одно сообщение удалено"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_MORE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"%d сообщений удалено"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение"</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Введите сообщение для отображения"</span></span></pre>
</div>
</div>
</div>
</div>
<div>
<p>Создайте архив с компонентом, установите его на сайт.</p>
</div>
<div>
<p><a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part10.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border: 0px; vertical-align: middle;" /> Скачать архив для этой части курса</a></p>
</div>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Fri, 23 Mar 2012 04:07:32 +0000</pubDate>
		</item>
		<item>
			<title>Конфигурация компонента</title>
			<link>http://tungusov.ru/adding-configuration-parameters.html</link>
			<guid>http://tungusov.ru/adding-configuration-parameters.html</guid>
			<description><![CDATA[<p>Создайте конфигурационный файл <span style="color: #0000ff;">admin/config.xml</span> со следующим кодом:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;config<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"greetings"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC"</span> </span></span>
<span style="vertical-align:top"><span style="color: #009900;">  <span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"show_category"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"radio"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC"</span> </span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">default</span>=<span style="color: #ff0000;">"0"</span> </span></span>
<span style="vertical-align:top"><span style="color: #009900;">  <span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"0"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JHIDE<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JSHOW<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/field<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/config<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>	</span></pre>
</div>
</div>
</div>
<p>Этот файл будет прочитан встроенным в Joomla! компонентом <span style="color: #0000ff;">com_config</span>. В конфигурации мы описали всего один параметр - отображать или же не отображать название категории в интерфейсе пользователя.</p>
<p>Откройте файл <span style="color: #0000ff;">admin/views/helloworlds/view.html.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorlds View</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorlds <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * HelloWorlds view display method</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Get data from the model</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Items'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Pagination'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Assign data to the view</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$items</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pagination</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Set the toolbar</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addToolBar</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Display the template</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Set the document</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Setting the toolbar</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> addToolBar<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">title</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLDS'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">deleteListX</span><span style="color: #009900;">(</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworlds.delete'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">editListX</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.edit'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">addNewX</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.add'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">preferences</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'com_helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to set up the document properties</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> setDocument<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_ADMINISTRATION'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Тем самым мы добавили кнопку для настройки нашего компонента. С помощью этой кнопки мы можем установить значение по умолчанию.</p>
<p style="text-align: center;"><img alt="013-01" src="http://tungusov.ru/images/stories/mvc-2.5/013-01.jpg" height="77" width="276" /></p>
<p>Так же сделаем, что для каждого сообщения можно задавать значение этого параметра индивидуально. Для этого откройте файл <span style="color: #0000ff;">admin/models/forms/helloworld.xml </span>и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;form</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">	<span style="color: #000066;">addrulepath</span>=<span style="color: #ff0000;">"/administrator/components/com_helloworld/models/rules"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"details"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"id"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"hidden"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"greeting"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">size</span>=<span style="color: #ff0000;">"40"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">class</span>=<span style="color: #ff0000;">"inputbox validate-greeting"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">validate</span>=<span style="color: #ff0000;">"greeting"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">required</span>=<span style="color: #ff0000;">"true"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">default</span>=<span style="color: #ff0000;">""</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"catid"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"category"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">extension</span>=<span style="color: #ff0000;">"com_helloworld"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">class</span>=<span style="color: #ff0000;">"inputbox"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">default</span>=<span style="color: #ff0000;">""</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">required</span>=<span style="color: #ff0000;">"true"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"0"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JOPTION_SELECT_CATEGORY<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/field<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fields</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"params"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"params"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"JGLOBAL_FIELDSET_DISPLAY_OPTIONS"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"show_category"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"list"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">default</span>=<span style="color: #ff0000;">""</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">				<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">""</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JGLOBAL_USE_GLOBAL<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">				<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"0"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JHIDE<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">				<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JSHOW<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/field<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fields<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/form<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Для хранения этого параметра нужно добавить в таблицу БД еще один столбец.</p>
<p>Откройте файл <span style="color: #0000ff;">admin/sql/install.mysql.utf8.sql </span>и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_sql">
<div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">DROP</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="font-weight: bold; color: #993333;">IF</span> <span style="font-weight: bold; color: #993333;">EXISTS</span> <span style="color: #ff0000;">`#__helloworld`</span>;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">CREATE</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="color: #66cc66;">(</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`greeting`</span> varchar<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`catid`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`params`</span> TEXT <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #993333;">PRIMARY</span> <span style="font-weight: bold; color: #993333;">KEY</span>  <span style="color: #66cc66;">(</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">)</span></span>
<span style="vertical-align:top"><span style="color: #66cc66;">)</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">INSERT</span> <span style="font-weight: bold; color: #993333;">INTO</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="color: #66cc66;">(</span><span style="color: #ff0000;">`greeting`</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">VALUES</span></span>
<span style="vertical-align:top">	<span style="color: #66cc66;">(</span><span style="color: #ff0000;">'Привет МИР! :) я из БД'</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">	<span style="color: #66cc66;">(</span><span style="color: #ff0000;">'Прощай МИР! :( я из БД'</span><span style="color: #66cc66;">)</span>;</span></pre>
</div>
</div>
</div>
<p>Также создайте файл <span style="color: #0000ff;">admin/sql/updates/mysql/0.0.13.sql</span> с кодом:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_sql">
<div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">ALTER</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="font-weight: bold; color: #993333;">ADD</span> <span style="color: #ff0000;">`params`</span> VARCHAR<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">1024</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">''</span>;</span></pre>
</div>
</div>
</div>
<p>Откройте файл <span style="color: #0000ff;">admin/tables/helloworld.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla table library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.database.table'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * Hello Table class</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldTableHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JTable</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Constructor</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param object Database connector object</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> __construct<span style="color: #009900;">(</span><span style="color: #339933;">&</span><span style="color: #000088;">$db</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Overloaded bind function</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param       array           named array</span>
<span style="vertical-align:top">	 * @return      null|string     null is operation was satisfactory, otherwise returns an error</span>
<span style="vertical-align:top">	 * @see JTable:bind</span>
<span style="vertical-align:top">	 * @since 1.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> bind<span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span> <span style="color: #339933;">&&</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #666666;">// Convert the params field to a string.</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$parameter</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">new</span> JRegistry<span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$parameter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadArray</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span>string<span style="color: #009900;">)</span><span style="color: #000088;">$parameter</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">bind</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Overloaded load function</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param       int $pk primary key</span>
<span style="vertical-align:top">	 * @param       boolean $reset reset data</span>
<span style="vertical-align:top">	 * @return      boolean</span>
<span style="vertical-align:top">	 * @see JTable:load</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> load<span style="color: #009900;">(</span><span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reset</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span>parent<span style="color: #339933;">::</span><span style="color: #004000;">load</span><span style="color: #009900;">(</span><span style="color: #000088;">$pk</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reset</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #666666;">// Convert the params field to a registry.</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">new</span> JRegistry<span style="color: #339933;">;</span>                 </span>
<span style="vertical-align:top">      <span style="font-style: italic; color: #666666;">// loadJSON is @deprecated    12.1  Use loadString passing JSON as the format instead.</span></span>
<span style="vertical-align:top">      <span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadString</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JSON'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">      <span style="font-style: italic; color: #666666;">//$params-&gt;loadJSON($this-&gt;item-&gt;params);             </span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$params</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">else</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Для того чтобы для каждого сообщения можно было указать свое значение параметра, нам нужно изменить шаблон <span style="color: #0000ff;">admin/views/helloworld/tmpl/edit.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld View</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * display method of Hello view</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// get the Data</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Form'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Item'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Script'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Assign the Data</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">script</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$script</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Set the toolbar</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addToolBar</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Display the template</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Set the document</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Setting the toolbar</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> addToolBar<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		JRequest<span style="color: #339933;">::</span><span style="color: #004000;">setVar</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'hidemainmenu'</span><span style="color: #339933;">,</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$isNew</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">title</span><span style="color: #009900;">(</span><span style="color: #000088;">$isNew</span> ? JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">		                             <span style="color: #339933;">:</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">save</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.save'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">cancel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.cancel'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$isNew</span> ? <span style="color: #0000ff;">'JTOOLBAR_CANCEL'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'JTOOLBAR_CLOSE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to set up the document properties</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> setDocument<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$isNew</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span><span style="color: #000088;">$isNew</span> ? JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_CREATING'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">		                           <span style="color: #339933;">:</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_EDITING'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addScript</span><span style="color: #009900;">(</span>JURI<span style="color: #339933;">::</span><span style="color: #004000;">root</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">script</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addScript</span><span style="color: #009900;">(</span>JURI<span style="color: #339933;">::</span><span style="color: #004000;">root</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">"/administrator/components/com_helloworld"</span></span>
<span style="vertical-align:top">		                                  <span style="color: #339933;">.</span> <span style="color: #0000ff;">"/views/helloworld/submitbutton.js"</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JText<span style="color: #339933;">::</span><span style="color: #004000;">script</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Откройте файл <span style="color: #0000ff;">admin/views/helloworld/tmpl/edit.php</span> и замените код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'behavior.tooltip'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'behavior.formvalidation'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFieldsets</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">&lt;form action="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JRoute<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'index.php?option=com_helloworld&layout=edit&id='</span><span style="color: #339933;">.</span><span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>"</span>
<span style="vertical-align:top">      method="post" name="adminForm" id="helloworld-form" class="form-validate"&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	&lt;div class="width-60 fltlft"&gt;</span>
<span style="vertical-align:top">		&lt;fieldset class="adminform"&gt;</span>
<span style="vertical-align:top">			&lt;legend&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_DETAILS'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/legend&gt;</span>
<span style="vertical-align:top">			&lt;ul class="adminformlist"&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>                      <span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFieldset</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'details'</span><span style="color: #009900;">)</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">				&lt;li&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">label</span><span style="color: #339933;">;</span>echo <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/li&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>                      <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">			&lt;/ul&gt;</span>
<span style="vertical-align:top">		&lt;/fieldset&gt;</span>
<span style="vertical-align:top">	&lt;/div&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	&lt;div class="width-40 fltrt"&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>        <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.start'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld-slider'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">             <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$params</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$fieldset</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span></span>
<span style="vertical-align:top">                <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.panel'</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">label</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'-params'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">                <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">)</span> <span style="color: #339933;">&&</span> <span style="color: #990000;">trim</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">    	        	&lt;p class="tip"&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">escape</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/p&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>           <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">		&lt;fieldset class="panelform" &gt;</span>
<span style="vertical-align:top">			&lt;ul class="adminformlist"&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>                        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFieldset</span><span style="color: #009900;">(</span><span style="color: #000088;">$name</span><span style="color: #009900;">)</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">				&lt;li&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">label</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/li&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>                        <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">			&lt;/ul&gt;</span>
<span style="vertical-align:top">		&lt;/fieldset&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>        <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.end'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">	&lt;/div&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	&lt;div&gt;</span>
<span style="vertical-align:top">		&lt;input type="hidden" name="task" value="helloworld.edit" /&gt;</span>
<span style="vertical-align:top">		<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'form.token'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">	&lt;/div&gt;</span>
<span style="vertical-align:top">&lt;/form&gt;</span></pre>
</div>
</div>
</div>
<p>Интерфейс пользователя так же нужно изменить.</p>
<p>Откройте файл <span style="color: #0000ff;">site/models/helloworld.php</span> и замените код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla modelitem library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.modelitem'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld Model</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldModelHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JModelItem</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * @var object item</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="color: #000088;">$item</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to auto-populate the model state.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * This method should only be called once per instantiation and is designed</span>
<span style="vertical-align:top">	 * to be called on the first call to the getState() method unless the model</span>
<span style="vertical-align:top">	 * configuration flag to ignore the request is set.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * Note. Calling getState in this method will result in recursion.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	void</span>
<span style="vertical-align:top">	 * @since	2.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> populateState<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$app</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getApplication</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Get the message id</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getInt</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setState</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'message.id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Load the parameters.</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$app</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParams</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setState</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'params'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$params</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">populateState</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Returns a reference to the a Table object, always creating it.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param	type	The table type to instantiate</span>
<span style="vertical-align:top">	 * @param	string	A prefix for the table class name. Optional.</span>
<span style="vertical-align:top">	 * @param	array	Configuration array for model. Optional.</span>
<span style="vertical-align:top">	 * @return	JTable	A database object</span>
<span style="vertical-align:top">	 * @since	2.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> getTable<span style="color: #009900;">(</span><span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'HelloWorld'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$prefix</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'HelloWorldTable'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> JTable<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$prefix</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Get the message</span>
<span style="vertical-align:top">	 * @return object The message to be displayed to the user</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> getItem<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getState</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'message.id'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">(</span><span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">				<span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld as h'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">				<span style="color: #339933;">-&gt;</span><span style="color: #004000;">leftJoin</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#__categories as c ON h.catid=c.id'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">				<span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'h.greeting, h.params, c.title as category'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">				<span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'h.id='</span> <span style="color: #339933;">.</span> <span style="color: #009900;">(</span>int<span style="color: #009900;">)</span><span style="color: #000088;">$id</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadObject</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">			<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">else</span></span>
<span style="vertical-align:top">			<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">				<span style="font-style: italic; color: #666666;">// Load the JSON string</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">new</span> JRegistry<span style="color: #339933;">;</span></span>
<span style="vertical-align:top">                                <span style="font-style: italic; color: #666666;">// loadJSON is @deprecated    12.1  Use loadString passing JSON as the format instead.</span></span>
<span style="vertical-align:top">				<span style="font-style: italic; color: #666666;">//$params-&gt;loadString($this-&gt;item-&gt;params, 'JSON');</span></span>
<span style="vertical-align:top">                                <span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadJSON</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$params</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">				<span style="font-style: italic; color: #666666;">// Merge global params with item params</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> clone <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getState</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">merge</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$params</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>так же замените код в файле <span style="color: #0000ff;">site/views/helloworld/view.html.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HTML View class for the HelloWorld Component</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #666666;">// Overwriting JView display method</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Assign data to the view</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Item'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Display the view</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>и в файле <span style="color: #0000ff;">site/views/helloworld/tmpl/default.php</span> на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">&lt;h1&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeting</span><span style="color: #339933;">.</span><span style="color: #009900;">(</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">category</span> and <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'show_category'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">                                      ? <span style="color: #009900;">(</span><span style="color: #0000ff;">' ('</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">category</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')'</span><span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">&lt;/h1&gt;</span></pre>
</div>
</div>
</div>
<p>Языковые файлы так же нужно изменить:</p>
<p><span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Hello World!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Administration"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Categories"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_CREATING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Creating"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_DETAILS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Details"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_EDITING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld - Editing"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Some values are unacceptable"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"The category the messages belongs to"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Category"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"This message will be displayed"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Show category"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"If set to Show, the title of the message’s category will show."</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Greeting"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager: Edit Message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager: New Message"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLDS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld manager"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_1</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"One message deleted"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_MORE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"%d messages deleted"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_MESSAGES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Messages"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Categories"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_CONFIGURATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"HelloWorld Configuration"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Messages settings"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Settings that will be applied to all messages by default"</span></span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">admin/language/ru-RU/ru-RU.com_helloworld.ini</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР!"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение для отображения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Приветствие"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_HEADING_ID</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Id"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Администрирование"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_ADMINISTRATION_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Категории"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_CREATING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Приветствие"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_DETAILS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Подробно"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_EDITING</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! - Изменить"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!: Изменить сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет Мир!: Добавить сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_MANAGER_HELLOWORLDS</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Привет МИР! управление"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_1</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Одно сообщение удалено"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_N_ITEMS_DELETED_MORE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"%d сообщений удалено"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_GREETING_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Введите сообщение для отображения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Некоторые значения недопустимы"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщение в категории"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Категория"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_MESSAGES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Сообщения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_SUBMENU_CATEGORIES</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Категории"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_CONFIGURATION</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Конфигурация"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Параметры сообщения"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Параметры вступят в силу для всех сообщений"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Выводить категорию"</span></span>
<span style="vertical-align:top"><span style="color: #000099;">COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Если показать, то будет показываться и категория."</span></span></pre>
</div>
</div>
</div>
<p>Ну и наконец в файле <span style="color: #0000ff;"><span id="helloworld.xml">helloworld.xml</span></span> измените версию компонента на <span style="color: #0000ff;">0.0.13 </span>и в секцию</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"admin"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span></pre>
</div>
</div>
</div>
<p>добавьте строки:</p>
<p> </p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>config.xml<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Создайте архив с компонентом, установите его на сайт.</p>
<p><a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part13.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать архив для этой части курса</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Thu, 05 Apr 2012 07:33:42 +0000</pubDate>
		</item>
		<item>
			<title>Как сделать собственную RSS-ленту</title>
			<link>http://tungusov.ru/how-to-make-your-own-rsslentu.html</link>
			<guid>http://tungusov.ru/how-to-make-your-own-rsslentu.html</guid>
			<description><![CDATA[<p>Шаг 1. Зайдите в <strong>каталог расширений для Joomla</strong> на Joomla.org в категорию <noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/content-&-news/rss-syndicate">RSS Syndicate</a></noindex>.</p>
<p>Шаг 2. Скачайте любой из этих компонентов: <strong>Kusoma RSS</strong>, <strong>BCA RSS Syndicator</strong> или платный <strong>jLord RSS Feed Creator</strong>. Любой из них нам подойдет. Мы же остановим наше внимание на <strong>BCA RSS Syndicator</strong>.</p>
<p>Шаг 3. Установите <strong>BCA RSS Syndicator</strong> с помощью установщика Joomla.</p>
<p>Шаг 4. Далее откройте меню Компоненты &gt;&gt;<strong> BCA RSS Syndicator</strong> и выберите вкладку “New”.</p>
<p>Шаг 5. Заполните все поля. Большинство этих полей говорят сами за себя. Здесь вы можете дать подходящее имя для вашей <strong>RSS-ленты</strong>, нажмите кнопку “Save”.</p>
<p style="text-align: center;"><img alt="rss1" src="http://tungusov.ru/images/stories/faq/rss1.png" width="500" height="602" /></p>
<p>Шаг 6. После того как вы сохраните свою ленту, скопируйте ее адрес.</p>
<p>Шаг 7. Теперь зайдите на <noindex><a target="_blank" rel="nofollow" href="http://feedburner.google.com">http://feedburner.google.com</a></noindex> и зарегистрируйтесь. Если у вас уже есть аккаунт на Google то можно использовать и его.</p>
<p>Шаг 8. Авторизуйтесь и введите скопированный адрес своей <strong>RSS-ленты</strong> в это поле:</p>
<p style="text-align: center;"><img alt="rss2" src="http://tungusov.ru/images/stories/faq/rss2.png" width="461" height="62" /></p>
<p>Шаг 9. Далее введите имя ленты для идентификации ее в вашем аккаунте на <strong>Feedburner</strong>, и введите адрес , где люди смогут найти ее.</p>
<p>Шаг 10. В дальнейшем вы сможете войти в <strong>Feedburner</strong> и посмотреть информацию сколько человек подписалось на вашу <strong>RSS-ленту</strong>.</p>
<p style="text-align: center;"><img alt="rss3" src="http://tungusov.ru/images/stories/faq/rss3.png" width="501" height="300" /></p>
<p>Шаг 11. Так же вы можете добавить адрес своей ленты в шаблон для того чтобы посетители вашего сайта могли легко добавить ее к себе в браузер. Для этого в шаблон вашего сайта между тегами &lt;head&gt; &lt;/head&gt; вставьте следующий код:</p>
<p>&lt;link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://your_rss_feed" /&gt;</p>
<p>Где  «http://your_rss_feed», адрес вашей ленты.</p>
<p><em>Например</em>: <span style="text-decoration: underline;">http://feeds2.feedburner.com/адрес_ленты_который_дали_на_шаге_9</span></p>
<p>Шаг 12. Так же можете зайти на <noindex><a target="_blank" rel="nofollow" href="https://siteexplorer.search.yahoo.com/submit">https://siteexplorer.search.yahoo.com/submit</a></noindex> и добавить свою RSS-ленту.</p>
<hr />
<h2>Видео-урок "Как сделать собственную RSS-ленту"</h2>
<p style="text-align: center;">
<object height="385" width="480" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
<param name="allowFullScreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="src" value="http://www.youtube.com/v/pG4sAwUOSo4&hl=ru_RU&fs=1" /><embed height="385" width="480" src="http://www.youtube.com/v/pG4sAwUOSo4&hl=ru_RU&fs=1" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash"></embed>
</object>
</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Fri, 30 Jul 2010 03:57:53 +0000</pubDate>
		</item>
		<item>
			<title>Как перенести сайт с локального компьютера на сервер в Интернете?</title>
			<link>http://tungusov.ru/how-to-move-a-site-from-a-local-computer-to-a-server-on-the-internet.html</link>
			<guid>http://tungusov.ru/how-to-move-a-site-from-a-local-computer-to-a-server-on-the-internet.html</guid>
			<description><![CDATA[<p>Наверное многие начинающие разработчики на Joomla сначала делают свой сайт локально, т.е. на своем компьютере, а затем уже переносят его на сервер в Интернете. Здесь мы покажем как это все делается.</p>
<p>В нашей работе мы будем использовать компонент называемый <noindex><a target="_blank" rel="nofollow" href="http://www.joomlapack.net/">Akeeba Backup</a></noindex>, он поможет нам в процессе переноса. Для начала мы воспользуемся компонентом Akeeba Backup чтобы создать резервную копию локально созданного сайта (файлы+база данных), затем мы будем использовать приложение Kickstart чтобы восстановить сайт из ранее созданной резервной копии.</p>
<p>А теперь все по шагам:</p>
<ol>
<li>Для начала скачайте компонент <noindex><a target="_blank" rel="nofollow" href="http://www.joomlapack.net/download/JoomlaPack-Components-download.html">Akeeba Backup</a></noindex>. Убедитесь, что вы скачаете последний релиз, на сегодня это 3.0.a4.</li>
<li>Скачать приложение <noindex><a target="_blank" rel="nofollow" href="http://joomlacode.org/gf/project/jpack/frs/?action=FrsReleaseBrowse&frs_package_id=4216">Kickstart</a></noindex>, снова убедившись что это последний релиз, на сегодня это версия 2.4. Распакуйте скачанный архив для дальнейшего использования.</li>
<li>В административной части вашего сайта откройте: «Расширения &gt; Установить/Удалить» и установите пакет с компонентом Akeeba Backup.</li>
<li>Далее откройте: «Компоненты &gt; Akeeba Backup &gt; Конфигурация. Перейдите на вкладку «Дополнительно» и найдите «Archiver Engine» и измените на «JPA Akeeba Backup» и нажмите кнопку «Сохранить».</li>
<li>Далее щелкните на кнопке “Backuo NOW”, начнется процесс резервного копирования.</li>
<li>Теперь найдите файл с резервной копией в папке /administrator/components/com_akeebabackup/Backup файл резервной копии будет иметь расширение JPA. Затем загрузите этот файл на удаленный сервер в папку где должны находиться HTML странички.</li>
<li>Загрузите приложение Kickstart в эту же директорию, он должен быть извлечен из архива, если вы этого не сделали раньше, то распакуйте, а затем загрузите.</li>
<li>На удаленном сервере сделайте базу данных используя PHPMyAdmin или же другой инструмент. </li>
<li>В браузере откройте страницу http://backup_directory/kickstart.php (где backup_directory это каталог находится файлы с резервной копией). Вставьте host, username, password и нажмите на зеленую кнопку "Пуск", начнется процесс восстановления, не закрывайте это окно.</li>
<li>После извлечения файлов из архива появится окно, в нем нажмите на кнопу чтобы запустить непосредственно сам скрипт восстановления.</li>
<li>Откроется новое окно и вы увидите типичный процесс при установке Joomla, но это не установка с нуля, а это процесс восстановления.</li>
<li>После успешной установки Joomla (восстановления в нашем случае) все окна можете закрыть. Процесс восстановления завершен, теперь можете открыть свой сайт уже на удаленном сервере.</li>
</ol>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Fri, 19 Mar 2010 18:23:05 +0000</pubDate>
		</item>
		<item>
			<title>Как обновить Joomla?</title>
			<link>http://tungusov.ru/how-to-upgrade-joomla.html</link>
			<guid>http://tungusov.ru/how-to-upgrade-joomla.html</guid>
			<description><![CDATA[<p>Здесь мы рассмотрим как обновить сайт под управлением Joomla 1.5 до последней версии.</p>
<ul>
<li>К сожалению ... нет «волшебной кнопки», чтобы обновить Joomla с версии 1.0 до 1.5 или с версии 1.5 до 1.6.</li>
<li>Если Вы вносили какие-нибудь изменения в основные файлы Joomla, вам необходимо обновить вручную.</li>
<li>Для начала сделайте резервную копию (<a href="http://tungusov.ru/how-to-move-a-site-from-a-local-computer-to-a-server-on-the-internet.html">проделайте шаги с 1 по 5 описанные в этой статье</a>).</li>
<li>Рассмотренное здесь решение является новым и мы рекомендуем его для дальнейшего обновления Joomla.</li>
</ul>
<p><strong>Вот как это делается:</strong></p>
<ol>
<li>Откройте адрес <noindex><a rel="nofollow" target="_blank" href="http://extensions.joomla.org/">http://extensons.joomla.org</a></noindex> и скачайте последнею версию компонента "<noindex><a rel="nofollow" target="_blank" href="http://extensions.joomla.org/extensions/core-enhancements/installers/9332">Update Manager for Joomla</a></noindex>".</li>
<li>В административной части сайта Joomla, перейдите на Расширения &gt;&gt; Установка и удаление программ и установите компонент.</li>
<li>Теперь перейдите Компоненты &gt;&gt; Update Manager.</li>
<li>Нажмите кнопку "download the update file &gt;&gt;&gt;".</li>
<li>Нажмите кнопку " Patch Package ".</li>
<li>Нажмите кнопку " you can proceed with the install &gt;&gt;&gt; ".</li>
<li>Через некоторое время Вы должны увидеть: "Вы успешно обновили Вашу Joomla! Поздравляем!".</li>
</ol>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Fri, 26 Mar 2010 11:02:54 +0000</pubDate>
		</item>
		<item>
			<title>Как изменить папку с изображениями в Joomla</title>
			<link>http://tungusov.ru/how-to-change-a-folder-with-images.html</link>
			<guid>http://tungusov.ru/how-to-change-a-folder-with-images.html</guid>
			<description><![CDATA[По умолчанию в Joomla все изображения должны находится в /images/stories/. Однако иногда требуется чтобы папка с изображениями находилась в /images/. Здесь мы расскажем как это сделать:<br /> 
<ul>
<li><strong>Шаг 1:</strong> Зайдите в административный раздел Joomla;</li>
<li><strong>Шаг 2:</strong> Откройте Сайт &gt;&gt; Общие настройки;</li>
<li><strong>Шаг 3:</strong> В настройках выберите вкладку «Система»;</li>
<li><strong>Шаг 4:</strong> Перейдите в "Установки Медиа менеджера "</li>
<li><strong>Шаг 5:</strong> В поле "Путь к папке с картинками",  пропишите нужный путь к папке с изображениями;</li>
<li><strong>Шаг 6: </strong>нажмите кнопку «Сохранить».</li>
</ul>
<div style="text-align: center;"><img alt="images_folder" src="http://tungusov.ru/images/stories/images_folder.jpg" height="236" width="404" /></div>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Fri, 05 Mar 2010 09:04:36 +0000</pubDate>
		</item>
		<item>
			<title>Как вставить видео или аудио в статью</title>
			<link>http://tungusov.ru/how-to-insert-video-or-audio-to-article.html</link>
			<guid>http://tungusov.ru/how-to-insert-video-or-audio-to-article.html</guid>
			<description><![CDATA[<p>Для этого мы будем использовать плагин, который называется <noindex><a rel="nofollow" target="_blank" href="http://www.joomlaworks.gr/content/view/16/42/">AllVideos</a></noindex>.</p>
<ol>
<li><noindex><a rel="nofollow" target="_blank" href="http://joomlaworks.googlecode.com/files/plg_jw_allvideos-v2.5.4_j1.5.zip">Скачайте</a></noindex> плагин AllVideos от JoomlaWorks.</li>
<li>В административной части вашего сайта, перейдите на Расширения &gt;&gt; Установка и удаление программ и установите плагин.</li>
<li>Далее перейдите на Расширения &gt;&gt; Менеджер плагинов, найдите и включите плагин AllVideos.</li>
<li>Теперь можете вставлять видео или аудио в статью с помощью тегов.</li>
</ol> 
<table class="allvideo" style="width: auto;">
<tbody>
<tr>
<th>Audio/Video Format</th> <th>Audio/Video folder set in params</th> <th>Actual file path</th> <th>AllVideos tag to enter in Joomla!</th>
</tr>
<tr>
<td>FLV</td>
<td>images/stories/videos</td>
<td>images/stories/videos/nadasurf.flv</td>
<td>{flv}nadasurf{/flv}</td>
</tr>
<tr>
<td>FLV hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/nadasurf.flv</td>
<td>{flvremote}http://www.tungusov.ru/nadasurf.flv{/flvremote}</td>
</tr>
<tr>
<td>MP3</td>
<td>images/stories/audio</td>
<td>images/stories/audio/pixies_bonemachine.mp3</td>
<td>{mp3}pixies_bonemachine{/mp3}</td>
</tr>
<tr>
<td>MP3 hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/pixies_bonemachine.mp3</td>
<td>{mp3remote}http://www.tungusov.ru/pixies_bonemachine.mp3{/mp3remote}</td>
</tr>
<tr>
<td>SWF (flash)</td>
<td>images/stories/videos</td>
<td>images/stories/videos/presentation.swf</td>
<td>{swf}presentation{/swf}</td>
</tr>
<tr>
<td>SWF (flash) hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/presentation.swf</td>
<td>{swfremote}http://www.tungusov.ru/presentation.swf{/swfremote}</td>
</tr>
<tr>
<td>WMV (Windows Media Video)</td>
<td>images/stories/videos</td>
<td>images/stories/videos/nadasurf.wmv</td>
<td>{wmv}nadasurf{/wmv}</td>
</tr>
<tr>
<td>WMV (Windows Media Video) hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/nadasurf.wmv</td>
<td>{wmvremote}http://www.tungusov.ru/nadasurf.wmv{/wmvremote}</td>
</tr>
<tr>
<td>WMA (Windows Media Audio)</td>
<td>images/stories/audio</td>
<td>images/stories/audio/pixies_bonemachine.wma</td>
<td>{wma}pixies_bonemachine{/wma}</td>
</tr>
<tr>
<td>WMA (Windows Media Audio) hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/pixies_bonemachine.wma</td>
<td>{wmaremote}http://www.tungusov.ru/pixies_bonemachine.wma{/wmaremote}</td>
</tr>
<tr>
<td>MOV (Quicktime Video)</td>
<td>images/stories/videos</td>
<td>images/stories/videos/nadasurf.mov</td>
<td>{mov}nadasurf{/mov}</td>
</tr>
<tr>
<td>MOV (Quicktime Video) hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/nadasurf.mov</td>
<td>{movremote}http://www.tungusov.ru/nadasurf.mov{/movremote}</td>
</tr>
<tr>
<td>MP4 (H.264 Video)</td>
<td>images/stories/videos</td>
<td>images/stories/videos/nadasurf.mp4</td>
<td>{mp4}nadasurf{/mp4}</td>
</tr>
<tr>
<td>MP4 (H.264 Video) hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/nadasurf.mp4</td>
<td>{mp4remote}http://www.tungusov.ru/nadasurf.mp4{/mp4remote}</td>
</tr>
<tr>
<td>3GP Video</td>
<td>images/stories/videos</td>
<td>images/stories/videos/nadasurf_mobile.3gp</td>
<td>{3gp}nadasurf{/3gp}</td>
</tr>
<tr>
<td>3GP Video hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/nadasurf_mobile.3gp</td>
<td>{3gpremote}http://www.tungusov.ru/nadasurf_mobile.3gp{/3gpremote}</td>
</tr>
<tr>
<td>DivX Video</td>
<td>images/stories/videos</td>
<td>images/stories/videos/nadasurf.divx</td>
<td>{divx}nadasurf{/divx}</td>
</tr>
<tr>
<td>DivX Video hosted on remote server</td>
<td>-</td>
<td>http://www.tungusov.ru/nadasurf.divx</td>
<td>{divxremote}http://www.tungusov.ru/nadasurf.divx{/divxremote}</td>
</tr>
</tbody>
</table>
<p> </p>
<table class="allvideo" style="width: auto;">
<tbody>
<tr>
<th>Video Provider</th> <th>Video URL</th> <th>Video ID</th> <th>AllVideos tag to enter in Joomla!</th>
</tr>
<tr>
<td>123video.nl</td>
<td>http://www.123video.nl/playvideos.asp?MovieID=248020</td>
<td>248020</td>
<td>{123video}248020{/123video}</td>
</tr>
<tr>
<td>aniboom.com</td>
<td>http://www.aniboom.com/video/28604/Kashe-Li-Its-Hard/</td>
<td>28604</td>
<td>{aniboom}28604{/aniboom}</td>
</tr>
<tr>
<td>badjojo.com [adult]</td>
<td>http://www.badjojo.com/video_play_front.php?Id=6718</td>
<td>6718</td>
<td>{badjojo}6718{/badjojo}</td>
</tr>
<tr>
<td>brightcove.tv</td>
<td>http://www.brightcove.tv/title.jsp?title=1656387563&channel=151854679</td>
<td>1656387563</td>
<td>{brightcove}1656387563{/brightcove}</td>
</tr>
<tr>
<td>collegehumor.com</td>
<td>http://www.collegehumor.com/video:1824771</td>
<td>1824771</td>
<td>{collegehumor}1824771{/collegehumor}</td>
</tr>
<tr>
<td>current.com</td>
<td>http://current.com/items/89150801_campaign_update_07_30_08</td>
<td>89150801</td>
<td>{current}89150801{/current}</td>
</tr>
<tr>
<td>dailymotion.com</td>
<td>http://www.dailymotion.com/featured/video/x35714_cap-nord-projet-1_creation</td>
<td>x35714</td>
<td>{dailymotion}x35714{/dailymotion}</td>
</tr>
<tr>
<td>video.espn.com</td>
<td>http://sports.espn.go.com/broadband/video/videopage?videoId=3503001&categoryId=3025809&n8pe6c=2</td>
<td>3503001</td>
<td>{espn}3503001{/espn}</td>
</tr>
<tr>
<td>eyespot.com</td>
<td>http://eyespot.com/share?cmd=permalink&r=0XCzIG2UEAy3criEJW0wIWu85o</td>
<td>0XCzIG2UEAy3criEJW0wIWu85o</td>
<td>{eyespot}0XCzIG2UEAy3criEJW0wIWu85o{/eyespot}</td>
</tr>
<tr>
<td>flurl.com</td>
<td>http://www.flurl.com/video/18402409_airport_musical.htm</td>
<td>18402409</td>
<td>{flurl}18402409{/flurl}</td>
</tr>
<tr>
<td>funnyordie.com</td>
<td>http://www.funnyordie.com/videos/7c52bd0f81</td>
<td>7c52bd0f81</td>
<td>{funnyordie}7c52bd0f81{/funnyordie}</td>
</tr>
<tr>
<td>gametrailers.com</td>
<td>http://www.gametrailers.com/player/37719.html</td>
<td>37719</td>
<td>{gametrailers}37719{/gametrailers}</td>
</tr>
<tr>
<td>godtube.com</td>
<td>http://www.godtube.com/view_video.php?viewkey=3336db1900a0d4d2df7e</td>
<td>3336db1900a0d4d2df7e</td>
<td>{godtube}3336db1900a0d4d2df7e{/godtube}</td>
</tr>
<tr>
<td>gofish.com</td>
<td>http://www.gofish.com/player.gfp?gfid=30-1212872</td>
<td>30-1212872</td>
<td>{gofish}30-1212872{/gofish}</td>
</tr>
<tr>
<td>Google Video</td>
<td>video.google.com/videoplay?docid=-814361516845782676</td>
<td>-814361516845782676</td>
<td>{google}-814361516845782676{/google}</td>
</tr>
<tr>
<td>guba.com</td>
<td>http://www.guba.com/watch/3000156661</td>
<td>3000156661</td>
<td>{guba}3000156661{/guba}</td>
</tr>
<tr>
<td>hook.tv</td>
<td>http://www.hook.tv/player.php?key=51AAAF57E594269E</td>
<td>51AAAF57E594269E</td>
<td>{hook}51AAAF57E594269E{/hook}</td>
</tr>
<tr>
<td>jumpcut.com</td>
<td>http://www.jumpcut.com/view?id=B4AC2D1607ED11DDA411000423CF0184</td>
<td>B4AC2D1607ED11DDA411000423CF0184</td>
<td>{jumpcut}B4AC2D1607ED11DDA411000423CF0184{/jumpcut}</td>
</tr>
<tr>
<td>kewego.com</td>
<td>http://www.kewego.com/video/iLyROoafYcaT.html</td>
<td>iLyROoafYcaT</td>
<td>{kewego}iLyROoafYcaT{/kewego}</td>
</tr>
<tr>
<td>krazyshow.com [adult]</td>
<td>http://www.krazyshow.com/media/playvideo.aspx?f=flash7&cid=FFE2C64AF5F843FB88A00B2FE31BD3BA</td>
<td>FFE2C64AF5F843FB88A00B2FE31BD3BA</td>
<td>{krazyshow}FFE2C64AF5F843FB88A00B2FE31BD3BA{/krazyshow}</td>
</tr>
<tr>
<td>ku6.com</td>
<td>http://v.ku6.com/show/mXbA6Nvfwba9H3m4.html</td>
<td>mXbA6Nvfwba9H3m4</td>
<td>{ku6}mXbA6Nvfwba9H3m4{/ku6}</td>
</tr>
<tr>
<td>liveleak.com</td>
<td>http://www.liveleak.com/view?i=2eb_1217374911</td>
<td>2eb_1217374911</td>
<td>{liveleak}2eb_1217374911{/liveleak}</td>
</tr>
<tr>
<td>livevideo.com</td>
<td>http://www.livevideo.com/video/APnews/F19F90BB55C64182A7F2AA222A982893/raw-video-at-least-7-killed-i.aspx</td>
<td>F19F90BB55C64182A7F2AA222A982893</td>
<td>{livevideo}F19F90BB55C64182A7F2AA222A982893{/livevideo}</td>
</tr>
<tr>
<td>metacafe.com</td>
<td>http://www.metacafe.com/watch/1560301/jet_car_goes_324_mph_for_texas_speed_record/</td>
<td>1560301/jet_car_goes_324_mph_for_texas_speed_record/</td>
<td>{metacafe}1560301/jet_car_goes_324_mph_for_texas_speed_record/{/metacafe}</td>
</tr>
<tr>
<td>mofile.com</td>
<td>http://tv.mofile.com/WGCQWS8D/</td>
<td>WGCQWS8D</td>
<td>{mofile}WGCQWS8D{/mofile}</td>
</tr>
<tr>
<td>myspace.com Videos</td>
<td>http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=37910278</td>
<td>37910278</td>
<td>{myspace}37910278{/myspace}</td>
</tr>
<tr>
<td>myvideo.de</td>
<td>http://www.myvideo.de/watch/4027656/Webcam_Julia_Privat_Akt_mein_erster_Song?p=hm21</td>
<td>4027656</td>
<td>{myvideo}4027656{/myvideo}</td>
</tr>
<tr>
<td>redtube.com [adult]</td>
<td>http://www.redtube.com/9194</td>
<td>9194</td>
<td>{redtube}9194{/redtube}</td>
</tr>
<tr>
<td>revver.com</td>
<td>http://www.revver.com/video/1072440/gnarls-barkley-whos-gonna-save-my-soul/</td>
<td>1072440</td>
<td>{revver}1072440{/revver}</td>
</tr>
<tr>
<td>sapo.pt</td>
<td>http://videos.sapo.pt/34NipYH7bWgUzc3pZgwo</td>
<td>34NipYH7bWgUzc3pZgwo</td>
<td>{sapo}34NipYH7bWgUzc3pZgwo{/sapo}</td>
</tr>
<tr>
<td>sevenload.com</td>
<td>http://en.sevenload.com/videos/C4vgVtx-Startrek-Just-Got-Smaller</td>
<td>C4vgVtx</td>
<td>{sevenload}C4vgVtx{/sevenload}</td>
</tr>
<tr>
<td>sohu.com</td>
<td>http://v.blog.sohu.com/u/vw/1478211</td>
<td>1478211</td>
<td>{sohu}1478211{/sohu}</td>
</tr>
<tr>
<td>southparkstudios.com</td>
<td>http://www.southparkstudios.com/clips/165195/</td>
<td>165195</td>
<td>{southpark}165195{/southpark}</td>
</tr>
<tr>
<td>spike.com (former iFilm)</td>
<td>http://www.spike.com/video/2881531</td>
<td>2881531</td>
<td>{spike}2881531{/spike}</td>
</tr>
<tr>
<td>stickam.com</td>
<td>http://www.stickam.com/viewMedia.do?mId=180191003</td>
<td>180191003</td>
<td>{stickam}180191003{/stickam}</td>
</tr>
<tr>
<td>stupidvideos.com</td>
<td>http://www.stupidvideos.com/video/just_plain_stupid/Spoon_Prank_1/#175073</td>
<td>175073</td>
<td>{stupidvideos}175073{/stupidvideos}</td>
</tr>
<tr>
<td>tudou.com</td>
<td>http://www.tudou.com/programs/view/sUMj-5Qpxr8/</td>
<td>sUMj-5Qpxr8</td>
<td>{tudou}sUMj-5Qpxr8{/tudou}</td>
</tr>
<tr>
<td>ustream.tv</td>
<td>http://www.ustream.tv/recorded/140603</td>
<td>140603</td>
<td>{ustream}140603{/ustream}</td>
</tr>
<tr>
<td>veoh.com</td>
<td>http://www.veoh.com/videos/v458872KnKgCCNF</td>
<td>v458872KnKgCCNF</td>
<td>{veoh}v458872KnKgCCNF{/veoh}</td>
</tr>
<tr>
<td>videotube.de</td>
<td>http://www.videotube.de/watch/41819</td>
<td>41819</td>
<td>{videotube}41819{/videotube}</td>
</tr>
<tr>
<td>vidiac.com</td>
<td>http://www.vidiac.com/video/fee38abd-b421-4873-bf7b-9841003cff17.htm</td>
<td>fee38abd-b421-4873-bf7b-9841003cff17</td>
<td>{vidiac}fee38abd-b421-4873-bf7b-9841003cff17{/vidiac}</td>
</tr>
<tr>
<td>vimeo.com</td>
<td>http://www.vimeo.com/1319796</td>
<td>1319796</td>
<td>{vimeo}1319796{/vimeo}</td>
</tr>
<tr>
<td>video.yahoo.com</td>
<td>http://video.yahoo.com/watch/3169238/8981933</td>
<td>3169238/8981933</td>
<td>{yahoo}3169238/8981933{/yahoo}</td>
</tr>
<tr>
<td>youare.tv</td>
<td>http://www.youare.tv/watch.php?id=2859</td>
<td>2859</td>
<td>{youare}2859{/youare}</td>
</tr>
<tr>
<td>youku.com</td>
<td>http://v.youku.com/v_show/id_XMzc2MDU3OTY=.html</td>
<td>id_XMzc2MDU3OTY=</td>
<td>{youku}id_XMzc2MDU3OTY={/youku}</td>
</tr>
<tr>
<td>youmaker.com</td>
<td>http://www.youmaker.com/video/sv?id=508ae75247584c5f8c5e6af6b8278edf001</td>
<td>508ae75247584c5f8c5e6af6b8278edf001</td>
<td>{youmaker}508ae75247584c5f8c5e6af6b8278edf001{/youmaker}</td>
</tr>
<tr>
<td>youtube.com</td>
<td>http://www.youtube.com/watch?v=DV81bAghxBU</td>
<td>DV81bAghxBU</td>
<td>{youtube}DV81bAghxBU{/youtube}</td>
</tr>
</tbody>
</table>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 24 Mar 2010 05:30:40 +0000</pubDate>
		</item>
		<item>
			<title>Использование базы данных</title>
			<link>http://tungusov.ru/using-database.html</link>
			<guid>http://tungusov.ru/using-database.html</guid>
			<description><![CDATA[<p>Обычно компоненты используют данные полученные из базы данных. Во время установки, удаления или обновления компонента, мы можем выполнять различные SQL запросы, эти запросы хранятся в текстовых файлах.
</p>
<p>Создайте два файла 
  <span style="color: #0000ff;">admin/sql/install.mysql.utf8.sql
  </span> и 
  <span style="color: #0000ff;">admin/sql/updates/mysql/0.0.6.sql
  </span> содержащих следующий код:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_sql">
    <div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">DROP</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="font-weight: bold; color: #993333;">IF</span> <span style="font-weight: bold; color: #993333;">EXISTS</span> <span style="color: #ff0000;">`#__helloworld`</span>;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">CREATE</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="color: #66cc66;">(</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`greeting`</span> varchar<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #993333;">PRIMARY</span> <span style="font-weight: bold; color: #993333;">KEY</span>  <span style="color: #66cc66;">(</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">)</span></span>
<span style="vertical-align:top"><span style="color: #66cc66;">)</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">INSERT</span> <span style="font-weight: bold; color: #993333;">INTO</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="color: #66cc66;">(</span><span style="color: #ff0000;">`greeting`</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">VALUES</span></span>
<span style="vertical-align:top">	<span style="color: #66cc66;">(</span><span style="color: #ff0000;">'Привет МИР! :) я из БД'</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">	<span style="color: #66cc66;">(</span><span style="color: #ff0000;">'Прощай МИР! :( я из БД'</span><span style="color: #66cc66;">)</span>;</span></pre>
    </div>
  </div>
</div>
<p>Файл 
  <span style="color: #0000ff;">admin/sql/install.mysql.utf8.sql
  </span> будет выполнен во время установки. Для этого нужно  в файл 
  <span style="color: #0000ff;">helloworld.xml 
  </span>добавить следующие строки:
</p><br />
<div class="rj_insertcode">
  <div class="rj_insertcode_xml">
    <div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;install<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on install --&gt;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;file</span> <span style="color: #000066;">driver</span>=<span style="color: #ff0000;">"mysql"</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">"utf8"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/install.mysql.utf8.sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/file<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/install<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
    </div>
  </div>
</div>
<p>Теперь создайте файл 
  <span style="color: #0000ff;">admin/sql/uninstall.mysql.utf8.sql 
  </span>со следующим кодом:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_sql">
    <div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">DROP</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="font-weight: bold; color: #993333;">IF</span> <span style="font-weight: bold; color: #993333;">EXISTS</span> <span style="color: #ff0000;">`#__helloworld`</span>;</span></pre>
    </div>
  </div>
</div>
<p>Этот файл будет выполнен во время удаления компонента. Для этого нужно в файл 
  <span style="color: #0000ff;">helloworld.xml 
  </span>добавить следующие строки:
</p><br />
<div class="rj_insertcode">
  <div class="rj_insertcode_xml">
    <div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;uninstall<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on uninstall --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;file</span> <span style="color: #000066;">driver</span>=<span style="color: #ff0000;">"mysql"</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">"utf8"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/uninstall.mysql.utf8.sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/file<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/uninstall<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
    </div>
  </div>
</div>
<p>В итоге файл
  <span style="color: #0000ff;"> helloworld.xml 
  </span>должен содержать следующий код:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_xml">
    <div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;extension</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"component"</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"2.5.0"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"upgrade"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>com_helloworld<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- The following elements are optional and free of formatting constraints --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Март 2012<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Имя автора<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>автор@домен.рф<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>http://домен.рф<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Copyright Info<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Лицензия<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!--  The version string is recorded in the components table --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>0.0.6<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- The description is optional and defaults to the name --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Это простой компонент приветствия ...<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;install<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on install --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;file</span> <span style="color: #000066;">driver</span>=<span style="color: #ff0000;">"mysql"</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">"utf8"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/install.mysql.utf8.sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/file<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/install<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;uninstall<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on uninstall --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;file</span> <span style="color: #000066;">driver</span>=<span style="color: #ff0000;">"mysql"</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">"utf8"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/uninstall.mysql.utf8.sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/file<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/sql<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/uninstall<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;update<span style="font-weight: bold; color: #000000;">&gt;</span></span></span> <span style="font-style: italic; color: #808080;">&lt;!-- Runs on update; New in 2.5 --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;schemas<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;schemapath</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"mysql"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>sql/updates/mysql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/schemapath<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/schemas<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/update<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- Site Main File Copy Section --&gt;</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #808080;">&lt;!-- Note the folder attribute: This attribute describes the folder</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">		to copy FROM in the package to install therefore files copied</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">		in this section are copied from /site/ in the package --&gt;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"site"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>helloworld.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>controller.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>views<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>models<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;administration<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #808080;">&lt;!-- Administration Menu Section --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Привет МИР!<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/menu<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #808080;">&lt;!-- Administration Main File Copy Section --&gt;</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #808080;">&lt;!-- Note the folder attribute: This attribute describes the folder</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">			to copy FROM in the package to install therefore files copied</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">			in this section are copied from /admin/ in the package --&gt;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files</span> <span style="color: #000066;">folder</span>=<span style="color: #ff0000;">"admin"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- Admin Main File Copy Section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>helloworld.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- SQL files section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>sql<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- tables files section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>tables<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #808080;">&lt;!-- models files section --&gt;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>models<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/administration<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/extension<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
    </div>
  </div>
</div>
<p><strong>Добавление нового типа поля</strong>
</p>
<p>Для использования базы данных в качестве источника строк в параметрах меню откройте файл <br />
  <span style="color: #0000ff;">site/views/helloworld/tmpl/default.xml
  </span> и замените в нем код на следующий:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_xml">
    <div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;metadata<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;layout</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;message<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/message<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/layout<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fields</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"request"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">addfieldpath</span>=<span style="color: #ff0000;">"/administrator/components/com_helloworld/models/fields"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">	<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"request"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"id"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"helloworld"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fields<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/metadata<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
    </div>
  </div>
</div>
<p>Этот код добавляет новый тип поля и указывает путь где находится его определение, в нашем случае это в папке 
  <span style="color: #0000ff;">administrator/components/com_helloworld/models/fields
  </span>
</p>
<p>Создайте файл 
  <span style="color: #0000ff;">admin/models/fields/helloworld.php
  </span> содержащий следующий код:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_php">
    <div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import the list field type</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.form.helper'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">JFormHelper<span style="color: #339933;">::</span><span style="color: #004000;">loadFieldClass</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'list'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld Form Field class for the HelloWorld component</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> JFormFieldHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JFormFieldList</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * The field type.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @var		string</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'HelloWorld'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to get a list of options for a list input.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	array		An array of JHtml options.</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> getOptions<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">(</span><span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'id,greeting'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">(</span><span style="color: #009900;">(</span>string<span style="color: #009900;">)</span><span style="color: #000088;">$query</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$messages</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadObjectList</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$messages</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$messages</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$message</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">			<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">				<span style="color: #000088;">$options</span><span style="color: #009900;">[</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'select.option'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeting</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">(</span>parent<span style="color: #339933;">::</span><span style="color: #004000;">getOptions</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$options</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
    </div>
  </div>
</div>
<p>Этот код создает новый тип поля, отображаться он будет как выпадающий список. Результат можно будет увидеть при создании пункта меню для нашего компонента.
</p>
<p style="text-align: center;">
  <img alt="006" src="http://tungusov.ru/images/stories/mvc-2.5/006.jpg" height="208" width="496" />
</p>
<p>Для вывода нужного сообщения в зависимости от выбранных параметров в меню откройте файл <br />
  <span style="color: #0000ff;">site/models/helloworld.php
  </span> и замените в нем код на следующий:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_php">
    <div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla modelitem library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.modelitem'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld Model</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldModelHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JModelItem</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * @var string msg</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="color: #000088;">$msg</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Returns a reference to the a Table object, always creating it.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param	type	The table type to instantiate</span>
<span style="vertical-align:top">	 * @param	string	A prefix for the table class name. Optional.</span>
<span style="vertical-align:top">	 * @param	array	Configuration array for model. Optional.</span>
<span style="vertical-align:top">	 * @return	JTable	A database object</span>
<span style="vertical-align:top">	 * @since	2.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> getTable<span style="color: #009900;">(</span><span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'HelloWorld'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$prefix</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'HelloWorldTable'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> JTable<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$prefix</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Get the message</span>
<span style="vertical-align:top">	 * @return string The message to be displayed to the user</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> getMsg<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getInt</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #666666;">// Get a TableHelloWorld instance</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$table</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTable</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #666666;">// Load the message</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">(</span><span style="color: #000088;">$id</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #666666;">// Assign the message</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeting</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
    </div>
  </div>
</div>
<p>Теперь модель получает сообщение у 
  <span style="color: #0000ff;">TableHelloWorld
  </span>. Этот класс таблицы должен быть описан в файле 
  <span style="color: #0000ff;">admin/tables/helloworld.php
  </span>.
</p>
<p>Создайте файл 
  <span style="color: #0000ff;">admin/tables/helloworld.php
  </span> со следующим кодом:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_php">
    <div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla table library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.database.table'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * Hello Table class</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldTableHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JTable</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Constructor</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param object Database connector object</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> __construct<span style="color: #009900;">(</span><span style="color: #339933;">&</span><span style="color: #000088;">$db</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
    </div>
  </div>
</div>
<p>Так же в файле 
  <span style="color: #0000ff;">helloworld.xml
  </span> в секцию 
  <span style="color: #0000ff;">&lt;files folder="admin"&gt;
  </span> добавьте следующие строки:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_xml">
    <div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-style: italic; color: #808080;">&lt;!-- tables files section --&gt;</span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>tables<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">&lt;!-- models files section --&gt;</span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>models<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
    </div>
  </div>
</div>
<p>и конечно же измените версию компонента на 
  <span style="color: #0000ff;">0.0.6
  </span>
</p>
<p>Создайте архив с компонентом, установите на сайт. После установки новой версии компонента изменений вы не увидите, но компонент уже будет работать с БД и данные будут браться из нее.
</p>
<p>
  <a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part06.zip"> 
    <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать архив для этой части курса</a>
</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Tue, 20 Mar 2012 10:06:19 +0000</pubDate>
		</item>
		<item>
			<title>Интерфейс администратора</title>
			<link>http://tungusov.ru/crate-backend.html</link>
			<guid>http://tungusov.ru/crate-backend.html</guid>
			<description><![CDATA[<p>Проектирование интерфейса администратора не обходится без создания структуры Model-View-Controller.</p>
<p>Откройте и отредактируйте файл <span style="color: #0000ff;">admin/helloworld.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import joomla controller library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.controller'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// Get an instance of the controller prefixed by HelloWorld</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$controller</span> <span style="color: #339933;">=</span> JController<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'HelloWorld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// Perform the Request task</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">(</span>JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getCmd</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'task'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// Redirect if set by the controller</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</div>
</div>
</div>
<p>Теперь основной файл компонента, для административной части, получает экземпляр контроллера с префиксом <span style="color: #0000ff;">HelloWorld</span>.</p>
<p><strong>Создание основного контроллера</strong></p>
<p>Созадайте файл <span style="color: #0000ff;">admin/controller.php</span> содержащий следующий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla controller library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.controller'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * General Controller of HelloWorld component</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldController <span style="font-weight: bold; color: #000000;">extends</span> JController</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * display task</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$cachable</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// set default view if not set</span></span>
<span style="vertical-align:top">		JRequest<span style="color: #339933;">::</span><span style="color: #004000;">setVar</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'view'</span><span style="color: #339933;">,</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getCmd</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'view'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'HelloWorlds'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// call parent behavior</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$cachable</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span></pre>
</div>
</div>
</div>
<p>Контроллер по умолчанию устанавливает вид для компонента <span style="color: #0000ff;">HelloWorlds</span>.</p>
<p><strong>Создание представления (вида)</strong></p>
<p>Создайте файл представления <span style="color: #0000ff;">admin/views/helloworlds/view.html.php</span> содержащий следующий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorlds View</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorlds <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * HelloWorlds view display method</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Get data from the model</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Items'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Pagination'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Assign data to the view</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$items</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pagination</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Display the template</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>В Joomla!, представления отображают данные с помощью шаблонов.</p>
<p>Создайте файл шаблона <span style="color: #0000ff;">admin/views/helloworlds/tmpl/default.php</span> содержащий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted Access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// load tooltip behavior</span></span>
<span style="vertical-align:top">JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'behavior.tooltip'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">&lt;form action="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JRoute<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'index.php?option=com_helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>" method="post" name="adminForm" id="adminForm"&gt;</span>
<span style="vertical-align:top">	&lt;table class="adminlist"&gt;</span>
<span style="vertical-align:top">		&lt;thead&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadTemplate</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'head'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/thead&gt;</span>
<span style="vertical-align:top">		&lt;tfoot&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadTemplate</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'foot'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/tfoot&gt;</span>
<span style="vertical-align:top">		&lt;tbody&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadTemplate</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'body'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/tbody&gt;</span>
<span style="vertical-align:top">	&lt;/table&gt;</span>
<span style="vertical-align:top">&lt;/form&gt;</span></pre>
</div>
</div>
</div>
<p>Шаблон вызывает еще несколько подчиненных шаблонов это <span style="color: #0000ff;">head</span>, <span style="color: #0000ff;">foot </span>и <span style="color: #0000ff;">body</span>. Каждый подчиненный шаблон должен иметь имя файла следующего вида <span style="color: #0000ff;">основнойшаблон_подчиненныйшаблон.php</span> и находиться в тойже папке что и основной шаблон. В нашем случае это файлы: <span style="color: #0000ff;">default_head.php</span>, <span style="color: #0000ff;">default_body.php</span> и <span style="color: #0000ff;">default_foot.php</span></p>
<p>Давайте создадим их</p>
<p><span style="color: #0000ff;">admin/views/helloworlds/tmpl/default_head.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted Access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">&lt;tr&gt;</span>
<span style="vertical-align:top">	&lt;th width="5"&gt;</span>
<span style="vertical-align:top">		<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_HEADING_ID'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">	&lt;/th&gt;</span>
<span style="vertical-align:top">	&lt;th width="20"&gt;</span>
<span style="vertical-align:top">		&lt;input type="checkbox" name="toggle" value="" onclick="checkAll(<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>);" /&gt;</span>
<span style="vertical-align:top">	&lt;/th&gt;			</span>
<span style="vertical-align:top">	&lt;th&gt;</span>
<span style="vertical-align:top">		<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">	&lt;/th&gt;</span>
<span style="vertical-align:top">&lt;/tr&gt;</span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">checkAll</span> это javascript функция объявленная в Joomla! позволяющая выделять все строки.</p>
<p><span style="color: #0000ff;">admin/views/helloworlds/tmpl/default_body.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted Access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$item</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align: top;">	&lt;tr class="row<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>"&gt;</span>
<span style="vertical-align: top;">		&lt;td&gt;</span>
<span style="vertical-align: top;">			<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align: top;">		&lt;/td&gt;</span>
<span style="vertical-align: top;">		&lt;td&gt;</span>
<span style="vertical-align: top;">			<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'grid.id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align: top;">		&lt;/td&gt;</span>
<span style="vertical-align: top;">		&lt;td&gt;</span>
<span style="vertical-align: top;">			<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeting</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align: top;">		&lt;/td&gt;</span>
<span style="vertical-align: top;">	&lt;/tr&gt;</span>
<span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span></pre>
</div>
</div>
</div>
<p>JHtml::_ это вспомогательная функция которая помогает отображать различный HTML код. В нашем случае она отображает checkbox для строк.</p>
<p><span style="color: #0000ff;">admin/views/helloworlds/tmpl/default_foot.php</span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted Access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">&lt;tr&gt;</span>
<span style="vertical-align:top">	&lt;td colspan="3"&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getListFooter</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/td&gt;</span>
<span style="vertical-align:top">&lt;/tr&gt;</span></pre>
</div>
</div>
</div>
<p><span style="color: #0000ff;">JPagination</span> это класс позволяющий управлять и выводить постраничную навигацию.</p>
<p><strong>Создание модели</strong></p>
<p>Модель является составителем SQL запросов для получения данных в представлении.</p>
<p>Создайте файл <span style="color: #0000ff;">admin/models/helloworlds.php</span> содержащий код:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import the Joomla modellist library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.modellist'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorldList Model</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldModelHelloWorlds <span style="font-weight: bold; color: #000000;">extends</span> JModelList</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to build an SQL query to load the list data.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	string	An SQL query</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> getListQuery<span style="color: #009900;">(</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Create a new query object.		</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">(</span><span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Select some fields</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'id,greeting'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// From the hello table</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Измените файл <span style="color: #0000ff;">helloworld.xml</span>, добавьте в секуцию <span style="color: #0000ff;">&lt;files folder="admin"&gt;</span> следующие строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>controller.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #808080;">&lt;!-- views files section --&gt;</span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>views<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/folder<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>исправьте в нем версию компонента на <span style="color: #0000ff;">0.0.7</span></p>
<p>Создайте архив с компонентом, установите его на сайт и проверьте работоспособность используя ссылку в меню в интерфейсе администратора.</p>
<p style="text-align: center;"><img alt="007" src="http://tungusov.ru/images/stories/mvc-2.5/007.jpg" height="129" width="764" /></p>
<div><a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part07.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать архив для этой части курса</a></div>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 21 Mar 2012 07:46:34 +0000</pubDate>
		</item>
		<item>
			<title>Добавление файла сценария для установки/удаления/обновления</title>
			<link>http://tungusov.ru/component/content/article/8-create-component-for-joomla-2-5/264-add-script-to-install-uninstall-update.html</link>
			<guid>http://tungusov.ru/component/content/article/8-create-component-for-joomla-2-5/264-add-script-to-install-uninstall-update.html</guid>
			<description><![CDATA[Установка, обновление, и удаление компонента могут потребовать дополнительных операций, которые не обеспечиваются основными операциями, описанными в основном файле xml.  Joomla предлагает новый подход к решению этой проблемы. Он заключается в использовании файла  php, содержащего класс, использующий пять методов:<br /> - preflight, который выполняется перед установкой и обновлением<br /> - install<br /> - update<br /> - uninstall<br /> - postflight, который выполняется после установки и обновления.<br />Написание сценария расширения заключается в объявлении класса с именем com_ИмяКомпонентаInstallerScript, который определяет эти пять методов.<br /><br />Создайте файл script.php со следующим кодом:<br /><br /><br /><br />Данный файл сценария будет при установке компонента направлять пользователя в компонент com_helloworld, а при обновлении или удалении - выводить сообщение. В методе обновления мы показываем новую версию, используя оператор $parent-&gt;get('manifest')-&gt;version.<br /><br />Языковые файлы так же нужно изменить:<br /><br />admin/language/en-GB/en-GB.com_helloworld.ini<br /><br />admin/language/ru-RU/ru-RU.com_helloworld.ini<br /><br /><br />Ну и наконец в файле helloworld.xml измените версию компонента на 0.0.15 и в секцию]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Fri, 03 Aug 2012 08:53:58 +0000</pubDate>
		</item>
		<item>
			<title>Добавление параметров в меню</title>
			<link>http://tungusov.ru/adding-variable-request-in-the-menu.html</link>
			<guid>http://tungusov.ru/adding-variable-request-in-the-menu.html</guid>
			<description><![CDATA[<p>Сейчас наш компонент в интерфейсе пользователя отображает одну лишь надпись «Привет МИР!». Joomla! 2.5 позволяет легко добавить параметры в меню для разного отображения нашего компонента. Для этого откройте файл 
  <span style="color: #0000ff;">site/views/helloworld/tmpl/default.xml
  </span> и замените в нем код на следующий:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_xml">
    <div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;metadata<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;layout</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;message<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/message<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/layout<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fields</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"request"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"request"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"id"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"list"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">				<span style="color: #000066;">default</span>=<span style="color: #ff0000;">"1"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">				<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>Привет МИР! :)<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">				<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"2"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>Прощай МИР! :(<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/field<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fields<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/metadata<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
    </div>
  </div>
</div>
<p>Так же нужно изменить несколько строк и в модели, в файле 
  <span style="color: #0000ff;">site/models/helloworld.php
  </span>:
</p>
<div class="rj_insertcode">
  <div class="rj_insertcode_php">
    <div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla modelitem library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.modelitem'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld Model</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldModelHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JModelItem</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * @var string msg</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="color: #000088;">$msg</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Get the message</span>
<span style="vertical-align:top">	 * @return string The message to be displayed to the user</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> getMsg<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getInt</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">switch</span> <span style="color: #009900;">(</span><span style="color: #000088;">$id</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">			<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">:</span></span>
<span style="vertical-align:top">					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Прощай МИР! :('</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">					<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">				<span style="font-weight: bold; color: #000000;">default</span><span style="color: #339933;">:</span></span>
<span style="vertical-align:top">				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span></span>
<span style="vertical-align:top">					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Привет МИР! :)'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">					<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
    </div>
  </div>
</div>
<p>В файле 
  <span style="color: #0000ff;">helloworld.xml 
  </span>измените версию компонента на 
  <span style="color: #0000ff;">0.0.5
  </span>
</p>
<p>Сделайте архив с компонентом и установите на сайт. Затем перейдите в менеджер меню и создайте пункт меню для нашего компонента. Теперь при создании меню справа вы увидите следующее:
</p>
<p style="text-align: center;">
  <img alt="005" src="http://tungusov.ru/images/stories/mvc-2.5/005.jpg" height="138" width="500" />
</p>
<p>Здесь мы можем выбрать какое сообщение отображать пользователю на экране.
</p>
<p>
  <a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part05.zip"> 
    <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать архив для этой части курса</a>
</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Mon, 19 Mar 2012 09:24:02 +0000</pubDate>
		</item>
		<item>
			<title>Добавление ACL (Access Control List) или контроль доступа. Часть 4</title>
			<link>http://tungusov.ru/add-acl-4.html</link>
			<guid>http://tungusov.ru/add-acl-4.html</guid>
			<description><![CDATA[<p>Теперь нам осталось добавить несколько строк в языковые файлы.</p>
<p>Откройте файл <span style="color: #0000ff;">admin/language/en-GB/en-GB.com_helloworld.ini</span> и добавьте следующие строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_ACCESS_DELETE_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Allows users to group delete this message."</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_ACCESS_EDIT_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Allows users to modify modify this message group."</span></span></pre>
</div>
</div>
</div>
<p>Откройте файл <span style="color: #0000ff;">admin/language/ru-RU/ru-RU.com_helloworld.ini <span style="color: #000000;">и добавьте следующие строки:</span></span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_ini">
<div class="ini" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_ACCESS_DELETE_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Разрешает пользователям группы удалять это сообщение."</span></span>
<span style="vertical-align: top;"><span style="color: #000099;">COM_HELLOWORLD_ACCESS_EDIT_DESC</span><span style="font-weight: bold; color: #000066;">=</span><span style="color: #993333;">"Разрешает пользователям группы изменять это сообщение."</span></span></pre>
</div>
</div>
</div>
<p>Теперь откройте файл <span style="color: #0000ff;">helloworld.xml</span>, измените версию компонента на <span style="color: #0000ff;">0.0.14</span>, в секцию <span style="color: #0000ff;">&lt;files folder="admin"&gt; <span style="color: #000000;">добавьте:</span><br /></span></p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filename<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>access.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filename<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Создайте архив с компонентом, установите его на сайт.</p>
<p><a class="jce_file" title="Скачать архив для этой части курса" href="http://tungusov.ru/images/stories/mvc-2.5/com_helloworld-part14.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border: 0px; vertical-align: middle;" /> Скачать архив для этой части курса</a></p>
<p>&nbsp;</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Thu, 21 Jun 2012 06:05:56 +0000</pubDate>
		</item>
		<item>
			<title>Добавление ACL (Access Control List) или контроль доступа. Часть 3</title>
			<link>http://tungusov.ru/add-acl-3.html</link>
			<guid>http://tungusov.ru/add-acl-3.html</guid>
			<description><![CDATA[<p>3. Для отображения поля для редактирования прав пользователя при редактировании сообщения нам нужно в файл <span style="color: #0000ff;">admin/models/forms/helloworld.xml</span> добавить следующие строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>  	</span>
<span style="vertical-align: top;">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"JFIELD_RULES_LABEL"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">translate_label</span>=<span style="color: #ff0000;">"false"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">filter</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">validate</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">class</span>=<span style="color: #ff0000;">"inputbox"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">		<span style="color: #000066;">component</span>=<span style="color: #ff0000;">"com_helloworld"</span> </span></span>
<span style="vertical-align: top;"><span style="color: #009900;">	        <span style="color: #000066;">section</span>=<span style="color: #ff0000;">"message"</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;">	<span style="font-weight: bold; color: #000000;">/&gt;</span></span>		</span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<p>Так же нужно отредактировать шаблон, откройте файл <span style="color: #0000ff;">admin/views/helloworld/tmpl/edit.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'behavior.tooltip'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'behavior.formvalidation'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFieldsets</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">&lt;form action="<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JRoute<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'index.php?option=com_helloworld&layout=edit&id='</span><span style="color: #339933;">.</span><span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>" method="post" name="adminForm" id="helloworld-form" class="form-validate"&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	&lt;div class="width-60 fltlft"&gt;</span>
<span style="vertical-align:top">		&lt;fieldset class="adminform"&gt;</span>
<span style="vertical-align:top">			&lt;legend&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_DETAILS'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/legend&gt;</span>
<span style="vertical-align:top">			&lt;ul class="adminformlist"&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFieldset</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'details'</span><span style="color: #009900;">)</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">				&lt;li&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">label</span><span style="color: #339933;">;</span>echo <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/li&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">			&lt;/ul&gt;</span>
<span style="vertical-align:top">		&lt;/fieldset&gt;</span>
<span style="vertical-align:top">	&lt;/div&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	&lt;div class="width-40 fltrt"&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>        <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.start'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld-slider'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">             <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$params</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$fieldset</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span></span>
<span style="vertical-align:top">                <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.panel'</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">label</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'-params'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">                <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">)</span> <span style="color: #339933;">&&</span> <span style="color: #990000;">trim</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">    	        	&lt;p class="tip"&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">escape</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #000088;">$fieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/p&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>           <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">		&lt;fieldset class="panelform" &gt;</span>
<span style="vertical-align:top">			&lt;ul class="adminformlist"&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFieldset</span><span style="color: #009900;">(</span><span style="color: #000088;">$name</span><span style="color: #009900;">)</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">				&lt;li&gt;<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">label</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span>&lt;/li&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">			&lt;/ul&gt;</span>
<span style="vertical-align:top">		&lt;/fieldset&gt;</span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span>        <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.end'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">	&lt;/div&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	&lt;!-- begin ACL definition--&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">   &lt;div class="clr"&gt;&lt;/div&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.admin'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">      &lt;div class="width-100 fltlft"&gt;</span>
<span style="vertical-align:top">         <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.start'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'permissions-sliders-'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'useCookie'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">            <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.panel'</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_FIELDSET_RULES'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'access-rules'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">            &lt;fieldset class="panelform"&gt;</span>
<span style="vertical-align:top">               <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLabel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'rules'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">               <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getInput</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'rules'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">            &lt;/fieldset&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">         <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.end'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">      &lt;/div&gt;</span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">   &lt;!-- end ACL definition--&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">  &lt;div&gt;</span>
<span style="vertical-align:top">		&lt;input type="hidden" name="task" value="helloworld.edit" /&gt;</span>
<span style="vertical-align:top">		<span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'form.token'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">	&lt;/div&gt;</span>
<span style="vertical-align:top">&lt;/form&gt;</span></pre>
</div>
</div>
</div>
<p>Здесь добавились следующие строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top">&lt;!-- begin ACL definition--&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">   &lt;div class="clr"&gt;&lt;/div&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.admin'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">:</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">      &lt;div class="width-100 fltlft"&gt;</span>
<span style="vertical-align:top">         <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.start'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'permissions-sliders-'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'useCookie'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">            <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.panel'</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_FIELDSET_RULES'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'access-rules'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">            &lt;fieldset class="panelform"&gt;</span>
<span style="vertical-align:top">               <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLabel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'rules'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">               <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getInput</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'rules'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">            &lt;/fieldset&gt;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">         <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #990000;">echo</span> JHtml<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'sliders.end'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top">      &lt;/div&gt;</span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #000000;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">   &lt;!-- end ACL definition--&gt;</span></pre>
</div>
</div>
</div>
<p>которые и будут выводить форму для редактирования прав пользователя.</p>
<p><a href="http://tungusov.ru/index.php?option=com_content&view=article&id=263:add-acl-4&catid=8:create-component-for-joomla-2-5&Itemid=252">Продолжение</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Thu, 21 Jun 2012 06:05:56 +0000</pubDate>
		</item>
		<item>
			<title>Добавление ACL (Access Control List) или контроль доступа. Часть 2</title>
			<link>http://tungusov.ru/add-acl-2.html</link>
			<guid>http://tungusov.ru/add-acl-2.html</guid>
			<description><![CDATA[<p>Следующим шагом мы добавим в конфигурацию нашего компонента вкладку для управления правами доступа к нему.</p>
<p style="text-align: center;"><a rel="lightbox[]" target="_blank" title="Добавление ACL (Access Control List) Joomla 2.5" href="http://tungusov.ru/images/stories/mvc-2.5/acl-1.jpg"><img title="Добавление ACL (Access Control List) Joomla 2.5" alt="acl-1" src="http://tungusov.ru/images/stories/mvc-2.5/acl-1_thumb.jpg" height="250" width="400" /></a></p>
<p style="text-align: left;">Откройте файл <span style="color: #0000ff;">admin/config.xml</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;config<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"greetings"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC"</span> </span></span>
<span style="vertical-align:top"><span style="color: #009900;">  <span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"show_category"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"radio"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC"</span> </span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">default</span>=<span style="color: #ff0000;">"0"</span> </span></span>
<span style="vertical-align:top"><span style="color: #009900;">  <span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"0"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JHIDE<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">			<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>JSHOW<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/option<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/field<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;fieldset</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"permissions"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"JCONFIG_PERMISSIONS_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JCONFIG_PERMISSIONS_DESC"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">	<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align:top">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;field</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">name</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">label</span>=<span style="color: #ff0000;">"JCONFIG_PERMISSIONS_LABEL"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">class</span>=<span style="color: #ff0000;">"inputbox"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">validate</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">filter</span>=<span style="color: #ff0000;">"rules"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">component</span>=<span style="color: #ff0000;">"com_helloworld"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">			<span style="color: #000066;">section</span>=<span style="color: #ff0000;">"component"</span></span></span>
<span style="vertical-align:top"><span style="color: #009900;">		<span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align:top">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/fieldset<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/config<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>	</span></pre>
</div>
</div>
</div>
<p>Для того что бы мы могли устанавливать права доступа для каждого сообщения в отдельности, нужно сделать следующее:</p>
<p style="text-align: left;">1. Добавить в таблицу <span style="color: #0000ff;">#__helloworld</span> столбец <span style="color: #0000ff;">asset_id</span>, который будет содержать ссылку на запись из таблицы <span style="color: #0000ff;">#__assets table</span> в котоой хранятся права доступа.</p>
<p style="text-align: left;">Откройте файл <span style="color: #0000ff;">admin/sql/install.mysql.utf8.sql</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_sql">
<div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">DROP</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="font-weight: bold; color: #993333;">IF</span> <span style="font-weight: bold; color: #993333;">EXISTS</span> <span style="color: #ff0000;">`#__helloworld`</span>;</span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">CREATE</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="color: #66cc66;">(</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`asset_id`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">UNSIGNED</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span> COMMENT <span style="color: #ff0000;">'FK to the #__assets table.'</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`greeting`</span> varchar<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`catid`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">  <span style="color: #ff0000;">`params`</span> TEXT <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span></span>
<span style="vertical-align:top">   <span style="font-weight: bold; color: #993333;">PRIMARY</span> <span style="font-weight: bold; color: #993333;">KEY</span>  <span style="color: #66cc66;">(</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">)</span></span>
<span style="vertical-align:top"><span style="color: #66cc66;">)</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="font-weight: bold; color: #993333;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8;</span></pre>
</div>
</div>
</div>
<p>Создайте файл <span style="color: #0000ff;">admin/sql/updates/mysql/0.0.14.sql</span> со следующим кодом:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_sql">
<div class="sql" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #993333;">ALTER</span> <span style="font-weight: bold; color: #993333;">TABLE</span> <span style="color: #ff0000;">`#__helloworld`</span> <span style="font-weight: bold; color: #993333;">ADD</span> <span style="color: #ff0000;">`asset_id`</span> int<span style="color: #66cc66;">(</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">)</span> <span style="font-weight: bold; color: #993333;">UNSIGNED</span> <span style="font-weight: bold; color: #993333;">NOT</span> <span style="font-weight: bold; color: #993333;">NULL</span> <span style="font-weight: bold; color: #993333;">DEFAULT</span> <span style="color: #ff0000;">'0'</span> COMMENT <span style="color: #ff0000;">'FK to the #__assets table.'</span>;</span></pre>
</div>
</div>
</div>
<p>2. Отредактировать ядро ACL. Для этого в файл <span style="color: #0000ff;">admin/models/helloworld.php</span> добавить следующие строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to test whether a record can be deleted.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param	object	A record object.</span>
<span style="vertical-align:top">	 * @return	boolean	True if allowed to delete the record. Defaults to the permission set in the component.</span>
<span style="vertical-align:top">	 * @since	1.6</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> canDelete<span style="color: #009900;">(</span><span style="color: #000088;">$record</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		  <span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getUser</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="color: #009900;">(</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">authorise</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.delete'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'com_helloworld.message.'</span><span style="color: #339933;">.</span><span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #000088;">$record</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #339933;">;</span>      </span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span>  </span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">  <span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method override to check if you can edit an existing record.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param	array	$data	An array of input data.</span>
<span style="vertical-align:top">	 * @param	string	$key	The name of the key for the primary key.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	boolean</span>
<span style="vertical-align:top">	 * @since	2.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> allowEdit<span style="color: #009900;">(</span><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'id'</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Check specific edit permission then general edit permission.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getUser</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">authorise</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'com_helloworld.message.'</span><span style="color: #339933;">.</span></span>
<span style="vertical-align:top">		                                      <span style="color: #009900;">(</span><span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$data</span><span style="color: #009900;">[</span><span style="color: #000088;">$key</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span> ? <span style="color: #000088;">$data</span><span style="color: #009900;">[</span><span style="color: #000088;">$key</span><span style="color: #009900;">]</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">		       or parent<span style="color: #339933;">::</span><span style="color: #004000;">allowEdit</span><span style="color: #009900;">(</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Эти две функции проверяют возможность пользователя удалять или изменять определенное сообщение.</p>
<p>Откройте файл <span style="color: #0000ff;">admin/tables/helloworld.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla table library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.database.table'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * Hello Table class</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldTableHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JTable</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Constructor</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param object Database connector object</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> __construct<span style="color: #009900;">(</span><span style="color: #339933;">&</span><span style="color: #000088;">$db</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">(</span><span style="color: #0000ff;">'#__helloworld'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Overloaded bind function</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param       array           named array</span>
<span style="vertical-align:top">	 * @return      null|string     null is operation was satisfactory, otherwise returns an error</span>
<span style="vertical-align:top">	 * @see JTable:bind</span>
<span style="vertical-align:top">	 * @since 1.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> bind<span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span> <span style="color: #339933;">&&</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #666666;">// Convert the params field to a string.</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$parameter</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">new</span> JRegistry<span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$parameter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadArray</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span>string<span style="color: #009900;">)</span><span style="color: #000088;">$parameter</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Bind the rules.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">isset</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'rules'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span> <span style="color: #339933;">&&</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'rules'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$rules</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">new</span> JAccessRules<span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'rules'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRules</span><span style="color: #009900;">(</span><span style="color: #000088;">$rules</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">    <span style="color: #b1b100;">return</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">bind</span><span style="color: #009900;">(</span><span style="color: #000088;">$array</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Overloaded load function</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @param       int $pk primary key</span>
<span style="vertical-align:top">	 * @param       boolean $reset reset data</span>
<span style="vertical-align:top">	 * @return      boolean</span>
<span style="vertical-align:top">	 * @see JTable:load</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> load<span style="color: #009900;">(</span><span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reset</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span>parent<span style="color: #339933;">::</span><span style="color: #004000;">load</span><span style="color: #009900;">(</span><span style="color: #000088;">$pk</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reset</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="font-style: italic; color: #666666;">// Convert the params field to a registry.</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">new</span> JRegistry<span style="color: #339933;">;</span>                 </span>
<span style="vertical-align:top">      <span style="font-style: italic; color: #666666;">// loadJSON is @deprecated    12.1  Use loadString passing JSON as the format instead.</span></span>
<span style="vertical-align:top">      <span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadString</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JSON'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">      <span style="font-style: italic; color: #666666;">//$params-&gt;loadJSON($this-&gt;item-&gt;params);             </span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$params</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">else</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to compute the default name of the asset.</span>
<span style="vertical-align:top">	 * The default name is in the form `table_name.id`</span>
<span style="vertical-align:top">	 * where id is the value of the primary key of the table.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	string</span>
<span style="vertical-align:top">	 * @since	2.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> _getAssetName<span style="color: #009900;">(</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_key<span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'com_helloworld.message.'</span><span style="color: #339933;">.</span><span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to return the title to use for the asset table.</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	string</span>
<span style="vertical-align:top">	 * @since	2.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> _getAssetTitle<span style="color: #009900;">(</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeting</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Get the parent asset id for the record</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return	int</span>
<span style="vertical-align:top">	 * @since	2.5</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> _getAssetParentId<span style="color: #009900;">(</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$asset</span> <span style="color: #339933;">=</span> JTable<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Asset'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadByName</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'com_helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p><a href="http://tungusov.ru/index.php?option=com_content&view=article&id=262:add-acl-3&catid=8:create-component-for-joomla-2-5">Продолжение</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Thu, 21 Jun 2012 06:05:56 +0000</pubDate>
		</item>
		<item>
			<title>Добавление ACL (Access Control List) или контроль доступа. Часть 1</title>
			<link>http://tungusov.ru/add-acl-1.html</link>
			<guid>http://tungusov.ru/add-acl-1.html</guid>
			<description><![CDATA[<p>С ACL разбираться долго пришлось, на русском доков почти нет, на буржуйском есть и очень мало, да и не все раскрыто и с ошибками, пришлось ковырять стандартные компоненты и разбираться. Надеюсь, что то, что переведено (и дополнено) вам поможет. Будут вопросы задавайте, если смогу отвечу.</p>
<hr />
<p><strong>Описание ACL (Список управления доступом)</strong></p>
<p>Каждый компонент имеет свои собственные ACL. Они могут быть описаны в файле access.xml, размещаемом в корне папки <span style="color: #0000ff;">admin</span>. В данном примере, мы разделим различные ACL на две секции: компонент и сообщения.</p>
<p>Создайте файл: admin/access.xml со следующим содержимым:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<div class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0px; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span> <span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;access</span> <span style="color: #000066;">component</span>=<span style="color: #ff0000;">"com_helloworld"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align: top;">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"component"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.admin"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_ADMIN"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_ADMIN_COMPONENT_DESC"</span> <span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.manage"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_MANAGE"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_MANAGE_COMPONENT_DESC"</span> <span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.create"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_CREATE"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_CREATE_COMPONENT_DESC"</span> <span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.delete"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_DELETE"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_DELETE_COMPONENT_DESC"</span> <span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.edit"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_EDIT"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"JACTION_EDIT_COMPONENT_DESC"</span> <span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align: top;">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/section<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"message"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.delete"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_DELETE"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_ACCESS_DELETE_DESC"</span> <span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align: top;">		<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;action</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"core.edit"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"JACTION_EDIT"</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">"COM_HELLOWORLD_ACCESS_EDIT_DESC"</span> <span style="font-weight: bold; color: #000000;">/&gt;</span></span></span>
<span style="vertical-align: top;">	<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/section<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align: top;"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/access<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</div>
</div>
</div>
<hr />
<p>В комментах как то попросили меня делать хоть какие то комментарии к коду, ладно исправлюсь, буду писать, но не много.</p>
<hr />
<p>В этом файле 2 секции: <span style="color: #0000ff;">component</span> и <span style="color: #0000ff;">message</span>.<br />Секция <span style="color: #0000ff;">component</span> содержит список действий, доступом к которым мы можем управлять, для нашего компонента в целом, а секция <span style="color: #0000ff;">message</span> содержит список действий для самих сообщений.<br /><br /><span style="color: #0000ff;">core.admin</span> - Настраивать (разрешает пользователям группы изменять настройки данного расширения)<br /><span style="color: #0000ff;">core.manage</span> - Управление компонентом (разрешает пользователям группы администрировать данное расширение)<br /><span style="color: #0000ff;">core.create</span> - Создавать (разрешает пользователям группы создавать любое содержимое в данном расширении)<br /><span style="color: #0000ff;">core.delete</span> - Удалять (разрешает пользователям группы удалять любое содержимое в данном расширении)<br /><span style="color: #0000ff;">core.edit </span>- Изменять (разрешает пользователям группы изменять любое содержимое в данном расширении)</p>
<p>Кстате, про <span style="color: #0000ff;">core.edit. <span style="color: #000000;">Если нам запрещено изменять сообщения, но разрешено создавать, то кнопка изменить на панеле инструментов тоже имеется, и мы можем выбрать какое либо сообщение и нажать на нее, НО кнопки "Сохранить" уже не будет, а вместо этого будет кнопка "Сохранить как копию". Во как!</span></span></p>
<p><strong>Ограничение доступа к компоненту<br /></strong><br />Основная идея ACL заключается в ограничении действий групп пользователей. Первым действием, которое ограничивается,  является доступ к самому компоненту. Используя привычный для вас текстовый редактор, отредактируйте файл <span style="color: #0000ff;">admin/helloworld.php</span>, по приведенному образцу:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0px; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// Access check.</span></span>
<span style="vertical-align: top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span>JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getUser</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">authorise</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.manage'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'com_helloworld'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;"><span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">	<span style="color: #b1b100;">return</span> JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseWarning</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">404</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'JERROR_ALERTNOAUTHOR'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"><span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// require helper file</span></span>
<span style="vertical-align: top;">JLoader<span style="color: #339933;">::</span><span style="color: #004000;">register</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'HelloWorldHelper'</span><span style="color: #339933;">,</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">(</span><span style="font-weight: bold; color: #000000;">__FILE__</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'helpers'</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #0000ff;">'helloworld.php'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// import joomla controller library</span></span>
<span style="vertical-align: top;">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.controller'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// Get an instance of the controller prefixed by HelloWorld</span></span>
<span style="vertical-align: top;"><span style="color: #000088;">$controller</span> <span style="color: #339933;">=</span> JController<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'HelloWorld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// Perform the Request task</span></span>
<span style="vertical-align: top;"><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">(</span>JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getCmd</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'task'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// Redirect if set by the controller</span></span>
<span style="vertical-align: top;"><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</div>
</div>
</div>
<p>Здесь строки:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0px; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// Access check.</span></span>
<span style="vertical-align: top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span>JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getUser</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">authorise</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.manage'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'com_helloworld'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;"><span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">	<span style="color: #b1b100;">return</span> JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseWarning</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">404</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'JERROR_ALERTNOAUTHOR'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>отвечают за доступ определенной группы пользователей к компоненту. Если какой то группе запрещен доступ, то мы не увидим нашего компонента в меню "Компоненты", если мы даже введем в строке браузера адрес:<span style="color: #0000ff;"> site.ru/administrator/index.php?option=com_helloworld</span>, то выпадет соответствующее сообщение, а именно "<span style="font-size: 11px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 16px; orphans: 2; text-indent: 30px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #e6c0c0; display: inline ! important; float: none; font-family: Arial,Helvetica,sans-serif; color: #cc0000;">Для просмотра этой информации необходимо пройти авторизацию</span>".</p>
<p><strong>Вывод только нужных кнопок на панель инструментов</strong><br /><br />То, какие кнопки панели инструментов, будут изображаться, зависит от установленных прав в ACL. <br /><br />Откройте файл <span style="color: #0000ff;">admin/views/helloworlds/view.html.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align:top">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorlds View</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorlds <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * HelloWorlds view display method</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Get data from the model</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Items'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Pagination'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Assign data to the view</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$items</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pagination</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Set the toolbar</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addToolBar</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Display the template</span></span>
<span style="vertical-align:top">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// Set the document</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Setting the toolbar</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> addToolBar<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$canDo</span> <span style="color: #339933;">=</span> HelloWorldHelper<span style="color: #339933;">::</span><span style="color: #004000;">getActions</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">title</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLDS'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.create'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">addNew</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.add'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_NEW'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.edit'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">editList</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_EDIT'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.delete'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">deleteList</span><span style="color: #009900;">(</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworlds.delete'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_DELETE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.admin'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">divider</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">			JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">preferences</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'com_helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Method to set up the document properties</span>
<span style="vertical-align:top">	 *</span>
<span style="vertical-align:top">	 * @return void</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	protected <span style="font-weight: bold; color: #000000;">function</span> setDocument<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_ADMINISTRATION'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Откройте файл <span style="color: #0000ff;">admin/views/helloworld/view.html.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin: 0px; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Restricted access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #666666;">// import Joomla view library</span></span>
<span style="vertical-align: top;">jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.application.component.view'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;"> * HelloWorld View</span>
<span style="vertical-align: top;"> */</span></span>
<span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">class</span> HelloWorldViewHelloWorld <span style="font-weight: bold; color: #000000;">extends</span> JView</span>
<span style="vertical-align: top;"><span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * display method of Hello view</span>
<span style="vertical-align: top;">	 * @return void</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	<span style="font-weight: bold; color: #000000;">public</span> <span style="font-weight: bold; color: #000000;">function</span> display<span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span> <span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">null</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// get the Data</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Form'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Item'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Script'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Check for errors.</span></span>
<span style="vertical-align: top;">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">count</span><span style="color: #009900;">(</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'Errors'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">		<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">			JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseError</span><span style="color: #009900;">(</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">			<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Assign the Data</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">script</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$script</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canDo</span> <span style="color: #339933;">=</span> HelloWorldHelper<span style="color: #339933;">::</span><span style="color: #004000;">getActions</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Set the toolbar</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addToolBar</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Display the template</span></span>
<span style="vertical-align: top;">		parent<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">(</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Set the document</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * Setting the toolbar</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	protected <span style="font-weight: bold; color: #000000;">function</span> addToolBar<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		JRequest<span style="color: #339933;">::</span><span style="color: #004000;">setVar</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'hidemainmenu'</span><span style="color: #339933;">,</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getUser</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$userId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$isNew</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$canDo</span> <span style="color: #339933;">=</span> HelloWorldHelper<span style="color: #339933;">::</span><span style="color: #004000;">getActions</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">title</span><span style="color: #009900;">(</span><span style="color: #000088;">$isNew</span> ? JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW'</span><span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <br />                                               JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'helloworld'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align: top;">		<span style="font-style: italic; color: #666666;">// Built the actions for new and existing records.</span></span>
<span style="vertical-align: top;">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$isNew</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">		<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">			<span style="font-style: italic; color: #666666;">// For new records, check the create permission.</span></span>
<span style="vertical-align: top;">			<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.create'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">			<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">				JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">apply</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.apply'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_APPLY'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">				JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">save</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.save'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_SAVE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">				JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">custom</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.save2new'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'save-new.png'</span><span style="color: #339933;">,</span> <br /><span style="color: #0000ff;">                                                       'save-new_f2.png'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_SAVE_AND_NEW'</span><span style="color: #339933;">,</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">			<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">			JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">cancel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.cancel'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_CANCEL'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">		<span style="color: #b1b100;">else</span></span>
<span style="vertical-align: top;">		<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">			<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.edit'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></span>
<span style="vertical-align: top;">			<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">				<span style="font-style: italic; color: #666666;">// We can save the new record</span></span>
<span style="vertical-align: top;">				JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">apply</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.apply'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_APPLY'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">				JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">save</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.save'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_SAVE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;"> </span>
<span style="vertical-align: top;">				<span style="font-style: italic; color: #666666;">// We can save this record, but check the create permission to see if we can <br />                                //return to make a new one.</span></span>
<span style="vertical-align: top;">				<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.create'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">				<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">					JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">custom</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.save2new'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'save-new.png'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;"><br />                                                               'save-new_f2.png'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_SAVE_AND_NEW'</span><span style="color: #339933;">,</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">				<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">			<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">			<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$canDo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'core.create'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">			<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">				JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">custom</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.save2copy'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'save-copy.png'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;"><br />                                                       'save-copy_f2.png'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_SAVE_AS_COPY'</span><span style="color: #339933;">,</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">			<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">			JToolBarHelper<span style="color: #339933;">::</span><span style="color: #004000;">cancel</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'helloworld.cancel'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JTOOLBAR_CLOSE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align: top;">	 * Method to set up the document properties</span>
<span style="vertical-align: top;">	 *</span>
<span style="vertical-align: top;">	 * @return void</span>
<span style="vertical-align: top;">	 */</span></span>
<span style="vertical-align: top;">	protected <span style="font-weight: bold; color: #000000;">function</span> setDocument<span style="color: #009900;">(</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align: top;">	<span style="color: #009900;">{</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$isNew</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span><span style="color: #000088;">$isNew</span> ? JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_CREATING'</span><span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <br />                                             JText<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_EDITING'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align: top;">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addScript</span><span style="color: #009900;">(</span>JURI<span style="color: #339933;">::</span><span style="color: #004000;">root</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">script</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addScript</span><span style="color: #009900;">(</span>JURI<span style="color: #339933;">::</span><span style="color: #004000;">root</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">"/administrator/components/com_helloworld/views/helloworld/submitbutton.js"</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">		JText<span style="color: #339933;">::</span><span style="color: #004000;">script</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align: top;">	<span style="color: #009900;">}</span></span>
<span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Эти два файла используют метод <span style="color: #0000ff;">getActions</span>, определенный в файле <span style="color: #0000ff;">admin/helpers/helloworld.php</span>.</p>
<p>Откройте файл <span style="color: #0000ff;">admin/helpers/helloworld.php</span> и замените в нем код на следующий:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<div class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">// No direct access to this file</span></span>
<span style="vertical-align:top"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'_JEXEC'</span><span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top"> * HelloWorld component helper.</span>
<span style="vertical-align:top"> */</span></span>
<span style="vertical-align:top">abstract <span style="font-weight: bold; color: #000000;">class</span> HelloWorldHelper</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Configure the Linkbar.</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="color: #990000;">static</span> <span style="font-weight: bold; color: #000000;">function</span> addSubmenu<span style="color: #009900;">(</span><span style="color: #000088;">$submenu</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	        JSubMenuHelper<span style="color: #339933;">::</span><span style="color: #004000;">addEntry</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_SUBMENU_MESSAGES'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;"><br />                                                  'index.php?option=com_helloworld'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$submenu</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'messages'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align:top">		JSubMenuHelper<span style="color: #339933;">::</span><span style="color: #004000;">addEntry</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_SUBMENU_CATEGORIES'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #0000ff;"><br />                                                  'index.php?option=com_categories&view=categories&extension=com_helloworld'</span><span style="color: #339933;">,</span> <span style="color: #000088;"><br />                                                  $submenu</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'categories'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align:top">		<span style="font-style: italic; color: #666666;">// set some global property</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addStyleDeclaration</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'.icon-48-helloworld {background-image: url('/../media/com_helloworld/images/hello_icon48.png');}'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$submenu</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'categories'</span><span style="color: #009900;">)</span> </span>
<span style="vertical-align:top">		<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">(</span>JText<span style="color: #339933;">::</span></span><span style="color: #990000;">_</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'COM_HELLOWORLD_ADMINISTRATION_CATEGORIES'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="font-style: italic; color: #009933;">/**</span>
<span style="vertical-align:top">	 * Get the actions</span>
<span style="vertical-align:top">	 */</span></span>
<span style="vertical-align:top">	<span style="font-weight: bold; color: #000000;">public</span> <span style="color: #990000;">static</span> <span style="font-weight: bold; color: #000000;">function</span> getActions<span style="color: #009900;">(</span><span style="color: #000088;">$messageId</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span>	</span>
<span style="vertical-align:top">		jimport<span style="color: #009900;">(</span><span style="color: #0000ff;">'joomla.access.access'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$user</span>	<span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getUser</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$result</span>	<span style="color: #339933;">=</span> <span style="font-weight: bold; color: #000000;">new</span> JObject<span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">empty</span><span style="color: #009900;">(</span><span style="color: #000088;">$messageId</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$assetName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'com_helloworld'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$assetName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'com_helloworld.message.'</span><span style="color: #339933;">.</span><span style="color: #009900;">(</span>int<span style="color: #009900;">)</span> <span style="color: #000088;">$messageId</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="color: #000088;">$actions</span> <span style="color: #339933;">=</span> JAccess<span style="color: #339933;">::</span><span style="color: #004000;">getActions</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'com_helloworld'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'component'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$actions</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$action</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">			<span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">(</span><span style="color: #000088;">$action</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">authorise</span><span style="color: #009900;">(</span><span style="color: #000088;">$action</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$assetName</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</div>
</div>
</div>
<p>Расписывать не буду, здесь я думаю и так все понятно (либо мы спрашиваем права для всего компонента, либо права для определенного сообщения, и в зависимости от полученного ответа выводим ту или иную кнопку.</p>
<p><a href="http://tungusov.ru/index.php?option=com_content&view=article&id=261:add-acl-2&catid=8:create-component-for-joomla-2-5&Itemid=250">Продолжение</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Thu, 21 Jun 2012 06:05:56 +0000</pubDate>
		</item>
		<item>
			<title>Альтернатива FTP клиенту</title>
			<link>http://tungusov.ru/alternative-ftp-client.html</link>
			<guid>http://tungusov.ru/alternative-ftp-client.html</guid>
			<description><![CDATA[<p>В этой статье мы рассмотрим альтернативу FTP клиенту. Для этого будем использовать компонент, который называется <noindex><a rel="nofollow" target="_blank" href="http://extensions.joomla.org/extensions/core-enhancements/file-management/4746/details">NinjaExplorer</a></noindex>.</p>
<ol>
<li><noindex><a rel="nofollow" target="_blank" href="http://ninjaforge.com/index.php?option=com_ninjacentral&page=show_package&id=44&Itemid=235">Скачайте</a></noindex> NinjaExplorer</li>
<li>В администрации части вашего сайта, перейдите на Расширения &gt;&gt; Установка и удаление программ и установите компонент.</li>
<li>Далее перейдите Компоненты &gt;&gt; NinjaXplorer и вы будете иметь доступ к каталогам и файлам на сервере.</li>
</ol>
<p>Этот инструмент может быть использован для загрузки, удаления и редактирования файлов.</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 24 Mar 2010 04:46:29 +0000</pubDate>
		</item>
		<item>
			<title>XML файл плагина - simpleaccordion.xml  (1 шаг)</title>
			<link>http://tungusov.ru/create-plugin-simple-accordion-step1.html</link>
			<guid>http://tungusov.ru/create-plugin-simple-accordion-step1.html</guid>
			<description><![CDATA[<p>XML файл всегда начинается с XML-тега и в параметре encoding указывается что кодировка UTF-8.</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<table class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"utf-8"</span><span style="font-weight: bold; color: #000000;">?&gt;</span></span></span>
<span style="vertical-align:top"><span style="color: #00bbdd;">&lt;!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD plugin 1.0//EN" "http://www.joomla.org/xml/dtd/1.5/plugin-install.dtd"&gt;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Для установщика Joomla нам нужно определить, что это плагин и это контент плагин, для этого добавим эту строку:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<table class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;install</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.5"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"plugin"</span> <span style="color: #000066;">group</span>=<span style="color: #ff0000;">"content"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>здесь параметр <span style="color: #333399;">type</span> определяет что это плагин, а <span style="color: #333399;">group</span> то что он относится к группе content, т.е контент плагин.</p>

<p>Далее добавим немножко информации о себе и о плагине:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<table class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
3
4
5
6
7
8
9
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Content - Simple Accordion<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/name<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Имя автора<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/author<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Email автора<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorEmail<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Сайт автора<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/authorUrl<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Дата создания<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/creationDate<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Копирайты<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/copyright<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Лицензия<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/license<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Версия плагина<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/version<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span>Описание плагина<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/description<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Далее идет перечисления файлов, т.е. структура плагина, в нашем случае это один файл - simpleaccordion.php</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<table class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
3
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;filename</span> <span style="color: #000066;">plugin</span>=<span style="color: #ff0000;">"simpleaccordion"</span><span style="font-weight: bold; color: #000000;">&gt;</span></span>simpleaccordion.php<span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/filename<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span>
<span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/files<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Так как для плагина нет дополнительных файлов требующихся для его работы и нет языковых файлов то теги <span style="color: #333399;">&lt;folder&gt;, &lt;languages&gt;</span> не рассматриваются.</p>
<p>Далее должны идти описание параметров плагина, но так как у нас их нет то тег <span style="color: #333399;">&lt;params&gt;</span> у нас пустой:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<table class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;params</span><span style="font-weight: bold; color: #000000;">/&gt;</span></span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>И наконец, не забывайте закрывающий тег:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_xml">
<table class="xml" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;"><span style="font-weight: bold; color: #000000;">&lt;/install<span style="font-weight: bold; color: #000000;">&gt;</span></span></span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p class="box-download"><a class="jce_file" title="Скачать файл simpleaccordion.xml" href="http://tungusov.ru/files/simpleaccordion.xml.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать файл simpleaccordion.xml</a></p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 14 Dec 2011 09:21:27 +0000</pubDate>
		</item>
		<item>
			<title>PHP файл плагина - simpleaccordion.php (2 шаг)</title>
			<link>http://tungusov.ru/create-plugin-simple-accordion-step2.html</link>
			<guid>http://tungusov.ru/create-plugin-simple-accordion-step2.html</guid>
			<description><![CDATA[<p>Начнем наш php файл с информации о лицензии, информации об авторе и собственно описания плагина.</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre>
</td>
<td style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="font-weight: bold; color: #000000;">&lt;?php</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;">/**</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * @version        $Id: simpleaccordion.php revision date lasteditedby $</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * @package        Joomla</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * @subpackage    Content</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * @copyright    Copyright (C)……………………. All rights reserved.</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * @license        GNU/GPL, see LICENSE.php</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * Joomla! is free software. This version may have been modified pursuant</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * to the GNU General Public License, and as distributed it includes or</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * is derivative of works licensed under the GNU General Public License or</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * other free or open source software licenses.</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> * See COPYRIGHT.php for copyright notices and details.</span></span>
<span style="vertical-align: top;"><span style="font-style: italic; color: #009933;"> */</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>

<p>Далее, как обычно, идет следующая строка:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php-brief">
<table class="php-brief" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0pt; background: none repeat scroll 0% 0% transparent; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #990000;">defined</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'_JEXEC'</span> <span style="color: #009900;">)</span> or <span style="color: #990000;">die</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'Restricted access'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Это строка предотвращает прямой доступ к файлу.</p>
<p>После этого нам нужно импортировать файл общего плагина из библиотеки Joomla!</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top">jimport<span style="color: #009900;">(</span> <span style="color: #0000ff;">'joomla.plugin.plugin'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Далее определим класс нашему плагину добавив следующую строчку:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">class</span> plgContentSimpleaccordion <span style="font-weight: bold; color: #000000;">extends</span> JPlugin</span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>заметьте что название плагина пишется уже с заглавной буквы.</p>
<p>Далее описываются действия плагина для определенного события. В нашем случае нас интересует событие <span style="color: #333399;">onPrepareContent</span> – это событие возникает перед отображением контента (статьи).</p>
<p>При наступлении этого события мы должны проверить статью на наличие наших строк, и если они найдены то заменить их на наш код.</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">function</span> onPrepareContent<span style="color: #009900;">(</span><span style="color: #339933;">&</span><span style="color: #000088;">$article</span><span style="color: #339933;">,</span> <span style="color: #339933;">&</span><span style="color: #000088;">$params</span><span style="color: #339933;">,</span> <span style="color: #000088;">$limitstart</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="color: #000088;">$regex</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">"#{simpleaccordion}(.*?){/simpleaccordion}#is"</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">(</span><span style="color: #000088;">$regex</span><span style="color: #339933;">,</span> <span style="color: #000088;">$article</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">text</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #000088;">$article</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">(</span><span style="color: #000088;">$regex</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">(</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'replacer'</span><span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000088;">$article</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">text</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #b1b100;">return</span> <span style="font-weight: bold; color: #000000;">true</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">/*</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">* Plugin replacer</span></span>
<span style="vertical-align:top"><span style="font-style: italic; color: #666666;">*/</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="font-weight: bold; color: #000000;">function</span> replacer<span style="color: #009900;">(</span><span style="color: #339933;">&</span><span style="color: #000088;">$match</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top"><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&</span>JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDocument</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #000088;">$accordions_text</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$match</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">]</span> ? <span style="color: #000088;">$match</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">]</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #990000;">preg_split</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#\|\|\|\|#'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$accordions_text</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> PREG_SPLIT_NO_EMPTY<span style="color: #009900;">)</span><span style="color: #009900;">)</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$accordions_text_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'#\|\|\|\|#'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$accordions_text</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> PREG_SPLIT_NO_EMPTY<span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	JHTML<span style="color: #339933;">::</span><span style="color: #990000;">_</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'behavior.mootools'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #000088;">$custom_js</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">"&lt;script type=<span style="font-weight: bold; color: #000099;">\"</span>text/javascript<span style="font-weight: bold; color: #000099;">\"</span>&gt;</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	&lt;!--</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	window.addEvent('domready', function(){</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	var AccordionObject = new Accordion('h4.togglers', 'div.elements', {display: -1, alwaysHide:true});</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	});</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	--&gt;</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	&lt;/script&gt;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="color: #0000ff;">	&lt;style&gt;</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	h4.togglers:hover {</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">		cursor: pointer;</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	}</span></span>
<span style="vertical-align:top"><span style="color: #0000ff;">	&lt;/style&gt;"</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addCustomTag</span><span style="color: #009900;">(</span><span style="color: #000088;">$custom_js</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top">	<span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;div class="accordion"&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$accordions_text_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$text</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$accordion_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'::'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text, 2</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$accordion_name</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$accordion_array</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">]</span> ? <span style="color: #990000;">strip_tags</span><span style="color: #009900;">(</span><span style="color: #990000;">trim</span><span style="color: #009900;">(</span><span style="color: #000088;">$accordion_array</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$accordion_array</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">]</span> ? <span style="color: #000088;">$accordion_array</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">]</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$html</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;h4 class="togglers"&gt;'</span><span style="color: #339933;">.</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">(</span><span style="color: #990000;">trim</span><span style="color: #009900;">(</span><span style="color: #000088;">$accordion_name</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/h4&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">		<span style="color: #000088;">$html</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div class="elements"&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$text</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #009900;">}</span></span>
<span style="vertical-align:top">	<span style="color: #000088;">$html</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top">	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$html</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Ну и в конце файла не забываем закрывать описание нашего класса символом:</p>
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Сохраняем наши файлы, упаковываем и пробуем установить, если установилось то не забываем его включить и пользуйтесь на здоровье!</p>
<div class="box-download">
<p><a class="jce_file" title="Скачать файл simpleaccordion.php" href="http://tungusov.ru/files/simpleaccordion.php.zip"> <img class="jce_icon" src="http://tungusov.ru/plugins/editors/jce/tiny_mce/plugins/filemanager/img/ext/zip_small.gif" title="zip" style="border:0px;vertical-align:middle;" /> Скачать файл simpleaccordion.php</a></p>
<p>Скачать плагин "Простой аккордеон" можно в нашем <a href="http://tungusov.ru/downloads/item/plugin-simleaccordion.html">файловом архиве</a></p>
</div>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 14 Dec 2011 09:27:15 +0000</pubDate>
		</item>
		<item>
			<title>10+1 самых популярных расширений</title>
			<link>http://tungusov.ru/10-most-popular-extensions.html</link>
			<guid>http://tungusov.ru/10-most-popular-extensions.html</guid>
			<description><![CDATA[<p>Тут собраны самые популярные расширения которые используют разработчики сайтов под управлением Joomla. Единственным критерием для этого списка является то, что они все абсолютно бесплатны и работает на последней версии Joomla. И так начнем:</p>
<hr />
<p><img style="margin-left: 10px; margin-bottom: 5px; margin-right: 10px; float: left;" alt="jce-editor" src="http://tungusov.ru/images/stories/jce-editor.jpg" width="100" height="47" /></p>
<h1 style="padding-top: 16px;"><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/edition/editors/88/details">Joomla Content Editor (JCE)</a></noindex></h1>
<p>Позволяет с легкостью создавать и редактировать содержимое вашего сайта.<br />Широкий набор инструментов дает возможность создавать содержимое без ограничений и необходимых знаний в HTML, XHTML, CSS ...</p>
<p style="text-align: center;"><img alt="jce-content-editor" src="http://tungusov.ru/images/stories/jce-content-editor.png" width="420" height="285" /></p>
<p>Редактор имеет интуитивно понятный интерфейс, что позволит вам без затруднений удалять, вырезать, копировать, вставлять изображения в статьи, создавать ссылки на другие разделы, категории и материалы, редактировать  html код с подсветкой синтаксиса.</p>
<hr />
<h1><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/2514/details">Компонент Mass Content</a></noindex></h1>
<p>Этот компонент очень полезен при создании сайтов на CMS Joomla, поскольку позволяет создавать сразу несколько категорий, разделов, а также создавать ссылки на них в различных меню, что избавляет от необходимости многократно повторять одни и теже операции при построении структуры сайта.</p>
<p style="text-align: center;"><a rel="lightbox[]" target="_blank" title="masscontent_0.3.png" href="http://tungusov.ru/images/stories/masscontent_0.3.png"><img alt="masscontent_0.3" src="http://tungusov.ru/images/stories/thumb_masscontent_0.3.jpg" width="250" height="127" /></a></p>
<hr />
<p><img style="margin-left: 10px; margin-bottom: 5px; margin-right: 10px; float: left;" alt="lazybackuplogo" src="http://tungusov.ru/images/stories/lazybackuplogo.jpg" width="64" height="64" /></p>
<h1 style="padding-top: 30px;"><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/access-&-security/backup/4445/details">Lazy Backup - резервное копирование БД сайта</a></noindex></h1>
<p>Lazy Backup – удачный плагин для резервирования Базы данных для Joomla! версии 1.5. Работает просто: отсылает резервные копии в zip-архивах через Х часов, Х дней на указанный почтовый ящик. Полезно использовать при взломах и т.п.</p>
<hr />
<p><img style="margin-right: 10px; margin-bottom: 5px; margin-left: 10px; float: left;" alt="42" src="http://tungusov.ru/images/stories/42.jpg" width="64" height="64" /></p>
<h1 style="padding-top: 27px;"><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/1606/details">JoomlaPack — инструмент для создания резервных копий</a></noindex></h1>
<p>Компонент предназначен для создания резервной копии сайта под управлением CMS Joomla!. Особенностью данного компонента является возможность создавать резервную копию базы данных и файлов проекта в один архив.</p>
<hr />
<p><img style="margin-left: 10px; margin-bottom: 5px; margin-right: 10px; float: left;" alt="com_xmap" src="http://tungusov.ru/images/stories/com_xmap.jpg" width="64" height="64" /></p>
<h1 style="padding-top: 34px;"><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/3066/details">XMap - карта сайта</a></noindex></h1>
<p>Популярный компонент для построения карты сайта.<br />Если у вас имеется расширение, написанное для Xmap, вы можете связаться с автором и отправить ему расширение для дальнейшего включения в дистрибутив новой версии компонента.</p>
<hr />
<p><img style="margin-left: 10px; margin-bottom: 5px; margin-right: 10px; float: left;" alt="jumi" src="http://tungusov.ru/images/stories/jumi.jpg" width="90" height="52" /></p>
<h1 style="padding-top: 12px;"><noindex><a rel="nofollow" target="_blank" href="http://extensions.joomla.org/extensions/edition/custom-code-in-content/1023/details">Jumi</a></noindex></h1>
<p>Компонент и прилагаемые к нему модуль и плагины позволяют легко включить javascript, php, html, css, dhtml или простой txt-файл в публикуемый материал или в модуль.</p>
<hr />
<p><img style="margin-right: 10px; margin-bottom: 5px; margin-left: 10px; float: left;" alt="eXtplorer" src="http://tungusov.ru/images/stories/eXtplorer.jpg" width="249" height="48" /></p>
<h1 style="padding-top: 7px;"><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/core-enhancements/file-management/2630/details">eXtplorer файловый менеджер</a></noindex></h1>
<p>Компонент предназначен для управления папками и файлами на сервере и может использоваться как для Joomla 1.5, так и для Joomla 1.0.X. , может функционировать как расширение для Joomla и как самостоятельное приложение.</p>
<hr />
<p><noindex><a rel="nofollow" target="_blank" href="http://extensions.joomla.org/extensions/core-enhancements/content-management/8061/details"><img alt="k2_logo" src="http://tungusov.ru/images/stories/k2_logo.jpg" width="162" height="64" /></a></noindex></p>
<p>Популярный компонент для создания и управления контентом сайта.</p>
<hr />
<p><img style="margin-right: 10px; margin-bottom: 5px; margin-left: 10px; float: left;" alt="metamod" src="http://tungusov.ru/images/stories/metamod.jpg" width="145" height="62" /></p>
<h1 style="padding-top: 27px;"><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/access-&-security/frontend-access-control/3391/details">Metamod - управляй своими модулями!</a></noindex></h1>
<p>Модуль который позволяет включение/выключение разных модулей на вашем сайте, в зависимости от времени года, даты, GeoIP - на основе поиска из какой страны пришел к вам посетитель и по другим факторам. Совместимость с Joomla 1.5/1.0</p>
<hr />
<p><img style="margin-right: 10px; margin-bottom: 5px; margin-left: 10px; float: left;" alt="Box_SM_fefefe_150" src="http://tungusov.ru/images/stories/Box_SM_fefefe_150.jpg" width="55" height="100" /></p>
<h1 style="padding-top: 50px;"><noindex><a target="_blank" rel="nofollow" href="http://extensions.joomla.org/extensions/directory-&-documentation/directory/1113/details">SOBI2 - универсальный конструктор каталогов</a></noindex></h1>
<p>С помощью этого компонента Вы можете собрать и настроить каталог чего-угодно. На сайте разработчиков помимо самого компонента выложено большое количество модулей и плагинов практически для любых задач.</p>
<hr />
<p><img style="margin-right: 10px; margin-bottom: 5px; margin-left: 10px; float: left;" alt="virtuemart" src="http://tungusov.ru/images/stories/virtuemart.jpg" width="150" height="59" /></p>
<h1 style="padding-top: 50px;"><noindex> <a target="_blank" rel="nofollow" href="http://virtuemart.net/">Компонент интернет-магазина VirtueMart</a> </noindex></h1>
<p>За частую перед веб-местерами встает вопрос: "<a target="_blank" href="http://7bloggers.ru/kak-sozdat-svoj-internet-magazin/" title="Как создать интернет магазин">Как создать интернет магазин</a>?", предлагаем вашему вниманию популярный бесплатный компонент интернет-магазина VirtueMart для Joomla! 1.5. Этот компонент позволяет реализовать на вашем сайте полнофункциональный, гибкий и расширяемый интернет-магазин.</p>]]></description>
			<author>webmaster@tungusov.ru (Hacked By Ayyıldız Tim)</author>
			<category>frontpage</category>
			<pubDate>Wed, 17 Mar 2010 07:57:02 +0000</pubDate>
		</item>
	</channel>
</rss>
