Answer the question
In order to leave comments, you need to log in
How to create a custom section on a Joomla site?
I maintain a site on Joomla 2.5, I had no experience with it before (I worked with Django). My task is to make a special section on the site, namely: the entrance to it must be password-protected, and only a limited circle of people can have a password (that is, regular registration is not suitable here, the password will be sent by mail). How can I do that? Please describe the procedure
Answer the question
In order to leave comments, you need to log in
You can make a separate group of users and allow them access to relevant materials (articles). You will manually transfer users to a separate group.
If not suitable - look for any plugins.
If the password is the same, create a new user, create a section visible only to him, although even if the passwords are different, the essence does not change, just the condition for PHP will become a little more complicated.
1. Well, then you generate a component containing the necessary information.
2. And then go to editing the component in the view
(for example:
C:\WebServers\home\dev.local\www\components\com_calctrans\views\calctrasform\tmpl\default.php)
--com_calctrans-name of your component will be generated by itself
- -calctrasform is a representation of your template (3 types are generated, a list, attributes of a specific element, and a form to fill in)
3. Add a PHP condition to check the password.
To access the database, you can use the code:
<?php
class ConnectDB{
public static function getListBD(){
// Подключаемся к базе данных
$db = JFactory::getDbo();
// Создаем новый объект запроса
$query = $db->getQuery(true);
// Добавляем сортировку
$query->select(array('from_city', 'to_city', 'price'));
$query->from('#__calctrans');
// Устанавливаем запрос
$db->setQuery($query);
// Загружаем результат как список объектов
return $result = $db->loadObjectList();
}
}
?>
foreach ($results as $item) {
if ($p_from == $p_to){
$p_price = 'Извините доставкой по городу не осуществляем.';
} else{
if (($p_from == $item->from_city) && ($p_to == $item->to_city)){
$p_price =$item->price . ' тысяч рублей';
/* break;*/
} else{
$p_price = 'Извините доставкой по городу не осуществляем.';
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question