C
C
Crash2014-01-06 10:41:30
Joomla
Crash, 2014-01-06 10:41:30

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

2 answer(s)
M
maxaon, 2014-01-06
@Bandicoot

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.

I
Igor Pushkarsky, 2014-01-07
@RainMEN

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();
        }
    }
?>

4. Then you run through all the objects and check if the fields match, something like
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 = 'Извините доставкой по городу не осуществляем.';
                }
            }
        }

5. And then the banal condition If the password matched, then show what you had in the default.php file before your changes
6. And then Menu-> New menu item -> Choose the menu type According to the name of your component and choose the view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question