168 lines
5.2 KiB
HTML
168 lines
5.2 KiB
HTML
title = "Пост"
|
|
url = "/old/post/:id/:slug"
|
|
layout = "new/master-inside"
|
|
is_hidden = 0
|
|
seo_keywords = "Türkmenistan, Turkmenistan, Туркменистан, Ориент новости, Orient news, Orienttm, Turkmen habarlary, Turkmen habarlar, Turkmen news, Новости Туркменистана, Новости СНГ, Новости средней азии, Новости Центральной Азии,"
|
|
robot_index = "index"
|
|
robot_follow = "follow"
|
|
|
|
[viewBag]
|
|
localeTitle[en] = "Post"
|
|
|
|
[blogPost]
|
|
slug = "{{ :slug }}"
|
|
id = "{{ :id }}"
|
|
categoryPage = 404
|
|
|
|
[views]
|
|
slug = "{{ :slug }}"
|
|
|
|
[SeoBlogPost]
|
|
post = "post"
|
|
==
|
|
<?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->count() > 0){
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
}
|
|
?>
|
|
==
|
|
{% put styles %}
|
|
|
|
<style>
|
|
p img {
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
|
|
{% endput %}
|
|
{% component 'SeoBlogPost' %}
|
|
|
|
|
|
{% set post = blogPost.post %}
|
|
|
|
<main class="article">
|
|
<div class="container">
|
|
<div class="article-inner">
|
|
<div class="article-content">
|
|
<div class="article-content-top">
|
|
<div class="article-head">
|
|
<h2>
|
|
{{post.title}}
|
|
</h2>
|
|
<span id="view" style="display: flex !important;">{{post.published_at|date('d.m.Y')}} | {{post.published_at|date('H:i')}} | <div style="padding-left: 10px;padding-right: 10px;"><img src="{{'assets/new/icons/eye.svg'|theme}}" alt="" style="width: 18px;" /></div> {% partial 'view' %}</span>
|
|
</div>
|
|
<div class="article-swiper-wrapper">
|
|
<div class="swiper articleSwiper">
|
|
<div class="swiper-wrapper">
|
|
|
|
{% if post.more_photo|length > 0 %}
|
|
|
|
{% for img in post.more_photo %}
|
|
|
|
<div class="swiper-slide">
|
|
<div class="article-item">
|
|
<img src="{{img.photoq|media_cdn|resize(692)}}" alt=" {{post.title}}" />
|
|
</div>
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
<div class="swiper-slide">
|
|
<div class="article-item">
|
|
<img src="{{post.featured_image|media_cdn|resize(692)}}" alt=" {{post.title}}" />
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
<div class="photo-prev video-prev article-prev">
|
|
<img src="{{'assets/new/icons/arrow-left-white.svg'|theme}}" alt="" />
|
|
</div>
|
|
<div class="photo-next video-next article-next">
|
|
<img src="{{'assets/new/icons/arrow-right-white.svg'|theme}}" alt="" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="article-desc">
|
|
{{post.content|md}}
|
|
|
|
|
|
<!-- <h5>ORIENT NEWS</h5>
|
|
-->
|
|
{% if post.img_source %}
|
|
<h5 style="font-style: italic;text-align: right;">{{ 'Фото'|_ }}: {{ post.img_source }}</h5>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% partial 'new/social' %}
|
|
|
|
</div>
|
|
|
|
|
|
{% partial 'new/post-featured' %}
|
|
|
|
</div>
|
|
{% partial 'newHome/right-sidebar.htm' class="article-aside" %}
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
{% put scripts %}
|
|
|
|
<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/article.js'|theme}}"></script>
|
|
{% endput %} |