Answer the question
In order to leave comments, you need to log in
How to add areas to the site on bitrix depending on the subdomain?
There is a site already quite old, on wordpress
. There we have implemented the implementation of dynamic subdomains, and there are areas in the templates that change depending on the current subdomain.
Example:
code inserted in footer template
<?php
// different footer data depends on subdomain
get_template_part('templates/phone');
?>
<?php
$domain = explode('.', $_SERVER['SERVER_NAME']);
if (sizeOf($domain) == 3) {
$file = realpath(__DIR__ . '/../' . ($part = 'templates/' . $domain[0] . '/phone') . '.php');
if (file_exists($file)) {
get_template_part($part);
return;
}
}
/**
* EDIT PHONE DATA BELOW
*/
?>
<p>+7 999 999 99 99</p>
Answer the question
In order to leave comments, you need to log in
It will turn out. And there are more elegant and convenient ways to implement it.
For example, phones should not be stored in a git, but in a database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question