Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 1 Ответов
  • 432 Просмотров
*

leha111

  • Захожу иногда
  • 226
  • 0 / 0
Роблемы со страницами
« : 02.10.2018, 12:39:20 »
Такая проблема: написал две страницы как плагин в виде :
В папке components/com_straisa1 создать файлы straisa1.xml и straisa1.php. В первом прописываю код
Код
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">

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

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

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

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

</extension>

В Joomle создаю в меню кнопку со ссылкой на внешний url https://domkomexpr/index.php?option=com_straisa1
Вторая страница создается также, только везде straisa2.
В straisa1.php прописываю
Код
<form action="" method="GET">
    <input type="text" name="username">
    <input type="submit">
</form>

<?php
//Если форма была отправлена и имя не пустое:
if (!empty($_REQUEST['username'])) {
    //Пишем имя в куки:
    setcookie('username', $_REQUEST['username'], time()+3600, '/');
}

?>


В straisa2.php

Код
<?php
//Если есть данные в куки об имени пользователя:
if (!empty($_COOKIE['username'])) {
    echo $_COOKIE['username']; //выведем имя на экран
}
?>

Только ничего не выводится. Если код со straisa1.php прописать в index.php шаблона сайта, то все работает нормально. В чём может быть проблема.
*

Septdir

  • Живу я здесь
  • 3370
  • 168 / 4
Re: Роблемы со страницами
« Ответ #1 : 02.10.2018, 12:48:35 »
В чём может быть проблема.
Проблема заключается в том, что написанное вам не компонент. Нет даже точки входа. Не говоря уже об MVC в целом.

Вот читаем https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component и не пропускаем шаги.
Не можете справиться с задачей сами пишите, решу ее за вас, не бесплатно*.
*Интересная задача, Деньги или Бартер. Натурой не беру!
CodersRank | Контакты | Мой GitHub | Workshop
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Как поменять переключение между страницами?

Автор Anna_N

Ответов: 3
Просмотров: 527
Последний ответ 13.06.2019, 16:54:32
от Anna_N
Как создать Joomla сайт с landing страницами?

Автор Mikha

Ответов: 2
Просмотров: 1414
Последний ответ 18.06.2016, 14:46:01
от Mikha
2 домена на 1 сайт с разными главными страницами

Автор kost757

Ответов: 10
Просмотров: 1283
Последний ответ 25.12.2013, 16:55:30
от b2z