Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div style="color:white">
- <?
- $start = microtime(true);
- $cookieCity = trim(htmlspecialchars($_COOKIE['gorod']));
- $basePhone = "+7 (800) 200-36-90 ";
- //echo '____'.$cookieCity;
- $cache_id = md5($cookieCity);
- $cacheTime = 3600;
- $cachePath = 'city_'.$cache_id;
- $obCache = new CPHPCache();
- if ($obCache->InitCache($cacheTime, $cacheId, $cachePath))
- {
- $arResult = $obCache->GetVars();
- $obCache->Output();
- }
- else
- {
- $obCache->StartDataCache();
- $arSelect = Array("ID","PROPERTY_TELEFON","PROPERTY_GOROD");
- $arFilter = Array("IBLOCK_ID"=>3, "NAME"=>$cookieCity, "ACTIVE"=>"Y");
- $arFilter = Array("IBLOCK_ID"=>3, "PROPERTY_GOROD"=>$cookieCity, "ACTIVE"=>"Y");
- $res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nTopCount"=>50), $arSelect);
- while($ob = $res->GetNextElement())
- {
- $arFields = $ob->GetFields();
- /* myprint_r($arFields['PROPERTY_TELEFON_VALUE'],2);
- myprint_r($arFields['PROPERTY_GOROD_VALUE'],2);*/
- $phones = $arFields['PROPERTY_TELEFON_VALUE'];
- }
- $phones = explode(',', $phones);
- //print_r($phones);
- ?>
- <? if ( $cookieCity!=='Минск' and $cookieCity!=='Москва'){ // не показываем телефон 8800 для москвы и минска?>
- <div class="phone-container"><a class="phone" href="tel:<?= $basePhone ?>"><?= $basePhone; ?></a></div>
- <?}?>
- <div class="phone-container"><a class="phone" href="tel:<?= $phones[0]?>"><?= $phones[0] ?></a></div>
- <? if ( $cookieCity=='Минск'){?>
- <div class="phone-container"><a class="phone" href="tel:<?= $phones[1]?>"><?= $phones[1] ?></a></div>
- <?}?>
- <?
- $obCache->EndDataCache(array("myDBResult"=>$arMyResult));
- }
- $time = microtime(true) - $start;
- printf('Скрипт выполнялся %.4F сек.', $time);
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement