# Настройка макета

### Вывод выбора города для посетителей сайта

В главном макете Вашего сайта укажите функцию **SelectCity\_GeoIp::getCountryLocationCity()** (php код перед \<head>) и css стили/js скрипты для работы модуля (обычно в пределах тега \<head>\</head>)

**SelectCity\_GeoIp::getCountryLocationCity()** - для автоопределение города посетителя и записи в сессию (можно не указывать)

{% tabs %}
{% tab title="php Core\_Page" %}
{% code lineNumbers="true" %}

```php
<?php
	// GeoIP определяет текущий город и сохраняет в $_SESSION['ASMP_City']
	SelectCity_GeoIp::getCountryLocationCity();
?>
<head>
	<!-- ... ваш код title и тд -->
	<?php
		Core_Page::instance()
			/* ... тут ваши css ... */
			->css('/hostcmsfiles/selectcity/css/style9999.css')
			->showCss();
	?>
	<?php
		Core_Page::instance()
			/* ... тут ваши js ... */
			/* все js должны быть подключены после jQuery */
			->js('/hostcmsfiles/selectcity/js/mp.autocomplete.js')
			->js('/hostcmsfiles/selectcity/js/script9999.js')
			->showJs();
	?>
</head>
```

{% endcode %}
{% endtab %}

{% tab title="html inline" %}
{% code lineNumbers="true" %}

```php
<?php
	// GeoIP определяет текущий город и сохраняет в $_SESSION['ASMP_City']
	SelectCity_GeoIp::getCountryLocationCity();
?>
<head>
	<!-- тут ваш код, css и js -->
	<link rel="stylesheet" type="text/css" href="/hostcmsfiles/selectcity/css/style9999.css" />
	
	<!-- все js selectcity должны быть подключены после jQuery -->
	<script src="/hostcmsfiles/selectcity/js/mp.autocomplete.js"></script>
	<script src="/hostcmsfiles/selectcity/js/script9999.js"></script>
</head>
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="danger" %}
**Готовый пример можно увидеть в демо макете созданном после установки модуля**

в css и js файлах **9999** - Ваш уникальный номер файла при установке, посмотреть можно в папке **/hostcmsfiles/selectcity/\*/**, т.к. все файлы без уникального номера при обновлении будут заменяться на новые
{% endhint %}

В главном макете Ваше сайта, в том месте где хотите вывести выбор города/региона вставьте код (например в шапке сайта)

{% code lineNumbers="true" fullWidth="true" %}

```php
<?php
// Показ и выбор города
$SelectCity_Controller_Show = new SelectCity_Controller_Show(
	Core_Entity::factory('Site', CURRENT_SITE)
);
				
$SelectCity_Controller_Show
	->xsl(Core_Entity::factory('Xsl')->getByName('SelectCity'))
	->show();
?>
```

{% endcode %}

* ***favoriteCities** — устанавливает массив идентификаторов городов фаворитов для показа*

{% hint style="info" %}
\*при установке XSL шаблоны идут с датой текущей установки в названии, например: **SelectCity \[05.06.2020 13:00:24]**
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.morozovpimnev.ru/selectcity/nastroika-maketa.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
