template.php
1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?
/** @var $item \SH\Entities\Partner */
require_once($_SERVER['DOCUMENT_ROOT'].'/mobile_detect.php');
if(empty($arResult['ITEMS'])) return;
?>
<? foreach($arResult['ITEMS'] as $i => $item) { ?>
<?
$title = $item->getPropValue('TITLE');
$subtitle = $item->getPropValue('SUBTITLE');
$videos = $item->getFiles('VIDEO');
$img = $item->hasPreviewImage()
? ($videos ? $item->getPreviewImageThumb(array('width' => 640, 'height' => 480, 'blur' => 5)) : $item->getPreivewImageUrl())
: false;
?>
<div class="mp-slide js-mp-slide<?= ($videos) ? ' _video' : '' ?><? if(!$i) { ?> _active<? } ?>" style="background-image: url(<?= $img ?>)">
<? if($videos) { ?>
<?
$videoUrls = array();
foreach($videos as $video) {
$videoUrls[] = $video->getUrl();
}
?>
<div class="mp-slide-video">
<video preload="auto" loop="loop" autoplay data-src='["<?= implode('","', $videoUrls) ?>"]'>
<? /*foreach($videos as $video) { ?>
<source src="<?= $video->getUrl() ?>" type="video/<?= $video->getExtension() ?>">
<? }*/ ?>
</video>
</div>
<? } ?>
<? if($title) { ?>
<? if($i) { ?>
<p class="mp-head-text _bigger"><?= $title ?></p>
<? } else { ?>
<h1 class="mp-head-text _bigger"><?= $title ?></h1>
<? } ?>
<? } ?>
<? if($subtitle) { ?>
<p class="mp-head-text"><?= $subtitle ?></p>
<? } ?>
</div>
<? } ?>