A
A
Alexey2017-09-17 12:31:26
Yii
Alexey, 2017-09-17 12:31:26

How to make a common admin panel for several domains?

Hello!
My task is to make a system of sites that are controlled by one admin panel.
Domains like:
magazin-moskva.ru
magazin-spb.ru
magazin-rostov.ru magazin-bobruisk.ru There is only one admin
panel
for everyone, access to it via any-domain/admin/
For all sites, a template and all resources (js, css, pictures) common. The database, respectively, is also shared.
In addition, each domain has a mobile version, which has a completely different template from the main one. Access to this template will be through the third-level domain m.
m.magazin-moskva.ru
m.magazin-spb.ru
m.magazin-rostov.ru
m.magazin-bobruisk.ru
Question 1: What is the best way to organize the directory structure for such a site system, taking into account the fact that the administrator could then add any number of domains without any problems? Which template (basic or advanced) should be taken as a basis, or can it create a different directory structure altogether?
Question 2 : I will need global variables that will depend on the domain name. For example,
$gorod = 'Moscow', $gorode = 'Moscow', $goroda = 'Moscow' => for the domain magazin-moskva.ru
$gorod = 'Saint Petersburg', $gorode = 'Saint Petersburg', $ goroda = 'St. Petersburg' => for magazin-spb.ru domain
$gorod = 'Rostov-on-Don', $gorode = 'Rostov-on-Don', $goroda = 'Rostov-on-Don' => for the domain magazin-rostov.ru
Where is the best place to write such variables? Does Yii have a domain name variable, or can you just use $_SERVER['HTTP_HOST']?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-09-17
@webinar

There is only one admin panel for everyone, the entrance to it is via any-domain/admin/

it's not alone. That's a lot of admins. One is admin.domain.com. And through it you can manage any number of sites on any domains. She doesn't really care at all. It just works with a database or databases. She is not aware that there is a front or several fronts and on which domains they live.
So specify 1 admin or many of the same.
On questions:
1) depends more on the project than on the presence of the admin panel. And we don't know anything about him. So it's hard to advise. More precisely, you can, if you poke your finger into the sky. I think "pokers" will appear.
2) As I understand it, it's better to write it in params at the stage of app formation. Because it is possible and the config will depend on it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question