ORIENT/themes/modern2/pages/new/afisha-post.htm

197 lines
5.9 KiB
HTML
Raw Normal View History

2023-01-09 12:49:08 +00:00
title = "Афиша"
2022-12-18 11:13:59 +00:00
url = "/new/afisha-post/:id/:slug"
layout = "new/master-inside"
is_hidden = 0
robot_index = "index"
robot_follow = "follow"
[views]
slug = "{{ :slug }}"
[blogPost]
slug = "{{ :slug }}"
id = "{{ :id }}"
categoryPage = 404
2023-01-09 12:49:08 +00:00
[SeoBlogPost]
post = "post"
2022-12-18 11:13:59 +00:00
==
2022-12-29 11:38:21 +00:00
<?php
function onStart(){
//dd($this->page->blogPost);
$postId = $this->param('id');
$currentPost = RainLab\Blog\Models\Post::where('id', $postId)->with(['category_groups'])->first();
$this['featuredPosts'] = RainLab\Blog\Models\Post::with(['categories'])->where('id', $postId)->paginate(10);
$catId = $this['featuredPosts'][0]->categories[0]->id;
//dd($this['featuredPosts'][0]->categories[0]->slug);
if($this->menuItems && $postId && $currentPost && $currentPost->category_groups){
$currentGroup = $currentPost->category_groups[0]->name;
foreach ($this->menuItems as $menu){
//dump($menu->title);
if($menu->title === $currentGroup){
$menu->isActive = true;
break;
}
}
}
// dd($this['posts']);
}
?>
==
2022-12-18 11:13:59 +00:00
{% put styles %}
<style>
p img {
width: 100%;
}
</style>
{% endput %}
2023-01-09 12:49:08 +00:00
{% component 'SeoBlogPost' %}
2022-12-18 11:13:59 +00:00
{% set post = blogPost.post %}
<main class="affiche-item">
<div class="container">
<div class="affiche-item-inner">
<div class="affiche-item-content">
<div class="affiche-item-head">
<h1>
{{post.title}}
</h1>
<span>{{post.published_at|date('d.m.Y')}} | {{post.published_at|date('H:i')}}</span>
</div>
<div class="affiche-item-item">
<div class="affiche-item-top">
2023-01-30 09:47:38 +00:00
<div class="affiche-swiper-wrapper">
<div class="swiper afficheSwiper">
<div class="swiper-wrapper">
{% if post.more_photo|length > 0 %}
{% for img in post.more_photo %}
<div class="swiper-slide">
<div class="affiche-item-img">
<img src="{{img.photoq|media}}" alt="{{post.title}}" />
</div>
</div>
{% endfor %}
{% else %}
<div class="swiper-slide">
<div class="affiche-item-img">
<img src="{{post.featured_image|media}}" alt="{{post.title}}" />
</div>
</div>
{% endif %}
2023-01-30 09:47:38 +00:00
</div>
<div class="photo-prev video-prev affiche-prev">
<img src="{{'assets/new/icons/arrow-left-white.svg'|theme}}" alt="" />
</div>
<div class="photo-next video-next affiche-next">
<img src="{{'assets/new/icons/arrow-right-white.svg'|theme}}" alt="" />
</div>
</div>
</div>
2023-01-30 09:47:38 +00:00
2022-12-18 11:13:59 +00:00
<div class="affiche-item-data">
<div class="affiche-item-data">
{% if post.afisha_address %}
<div class="affiche-item-data-row">
<div class="affiche-item-data-img">
<img src="{{'assets/new/icons/location.svg'|theme}}" alt="" />
</div>
<span>{{ post.afisha_address }}</span>
</div>
{% endif %}
2023-01-10 07:56:35 +00:00
{% if post.afisha_phone %}
2022-12-18 11:13:59 +00:00
<div class="affiche-item-data-row">
<div class="affiche-item-data-img">
<img src="{{'assets/new/icons/phone.svg'|theme}}" alt="" />
</div>
<span>{{ post.afisha_phone }}</span>
</div>
{% endif %}
2023-01-09 12:49:08 +00:00
<div id="view" class="affiche-item-data-row">
2022-12-18 11:13:59 +00:00
<div class="affiche-item-data-img">
<img src="{{'assets/new/icons/eye.svg'|theme}}" alt="" />
</div>
2023-01-09 12:49:08 +00:00
{% partial 'view' %}
2022-12-18 11:13:59 +00:00
</div>
</div>
</div>
2022-12-18 11:13:59 +00:00
</div>
<div class="affiche-item-bottom">
{{post.content|md}}
</div>
</div>
</div>
{% partial 'newHome/right-sidebar.htm' class="article-aside" %}
</div>
</div>
</main>
{% put scripts %}
2023-01-09 12:49:08 +00:00
<script>
$.request('views::onIncrement', {
update: { view: '@#view' },
})
var re = /\[video poster=\"(.+?)\".+?mp4=\"(.+?)\"/g;
// re = /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/g
var ptags = document.querySelectorAll('p');
ptags.forEach(s => {
var m;
m = re.exec(s.innerText);
if (m) {
var video = document.createElement('video');
video.setAttribute('src', m[2]);
video.setAttribute('controls', "")
video.setAttribute('width', "100%")
video.setAttribute('type', "video/mp4")
video.setAttribute('poster', m[1])
s.parentNode.replaceChild(video, s);
}
});
</script>
<script src="{{'assets/new/scripts/core/affiche-item.js'|theme}}"></script>
2022-12-18 11:13:59 +00:00
{% endput %}