ORIENT/themes/modern2/pages/new/newPost.htm

164 lines
5.0 KiB
HTML
Raw Normal View History

2022-12-25 12:30:38 +00:00
title = "Пост"
2022-12-29 11:38:21 +00:00
url = "/post/:id/:slug"
2022-12-16 06:59:28 +00:00
layout = "new/master-inside"
2022-12-06 15:33:01 +00:00
is_hidden = 0
2022-12-25 12:30:38 +00:00
seo_keywords = "Türkmenistan, Turkmenistan, Туркменистан, Ориент новости, Orient news, Orienttm, Turkmen habarlary, Turkmen habarlar, Turkmen news, Новости Туркменистана, Новости СНГ, Новости средней азии, Новости Центральной Азии,"
2022-12-06 15:33:01 +00:00
robot_index = "index"
robot_follow = "follow"
2022-12-25 12:30:38 +00:00
[viewBag]
localeTitle[en] = "Post"
2022-12-06 15:33:01 +00:00
[views]
slug = "{{ :slug }}"
[blogPost]
slug = "{{ :slug }}"
id = "{{ :id }}"
2022-12-19 20:27:54 +00:00
categoryPage = 404
2022-12-25 12:30:38 +00:00
[SeoBlogPost]
post = "post"
2022-12-19 20:27:54 +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();
2022-12-25 12:30:38 +00:00
$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);
2022-12-19 20:27:54 +00:00
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;
}
}
}
2022-12-25 12:30:38 +00:00
// dd($this['posts']);
2022-12-19 20:27:54 +00:00
}
?>
2022-12-06 15:33:01 +00:00
==
{% put styles %}
<style>
p img {
width: 100%;
}
</style>
{% endput %}
2022-12-25 12:30:38 +00:00
{% component 'SeoBlogPost' %}
2022-12-06 15:33:01 +00:00
{% 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>
2022-12-23 09:55:31 +00:00
<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>
2022-12-06 15:33:01 +00:00
</div>
<div class="article-swiper-wrapper">
<div class="swiper articleSwiper">
<div class="swiper-wrapper">
2022-12-23 09:55:31 +00:00
{% if post.more_photo|length > 0 %}
{% for img in post.more_photo %}
<div class="swiper-slide">
<div class="article-item">
2022-12-25 12:30:38 +00:00
<img src="{{img.photoq|media_cdn|resize(692)}}" alt=" {{post.title}}" />
2022-12-23 09:55:31 +00:00
</div>
</div>
{% endfor %}
{% else %}
2022-12-06 15:33:01 +00:00
<div class="swiper-slide">
<div class="article-item">
2022-12-25 12:30:38 +00:00
<img src="{{post.featured_image|media_cdn|resize(692)}}" alt=" {{post.title}}" />
2022-12-06 15:33:01 +00:00
</div>
</div>
2022-12-23 09:55:31 +00:00
{% endif %}
2022-12-06 15:33:01 +00:00
</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}}
2022-12-25 12:30:38 +00:00
2022-12-06 15:33:01 +00:00
2022-12-14 15:55:13 +00:00
<!-- <h5>ORIENT NEWS</h5>
<h5>Фото: figma.com</h5> -->
2022-12-06 15:33:01 +00:00
</div>
{% partial 'new/social' %}
</div>
{% partial 'new/post-featured' %}
</div>
2022-12-14 15:55:13 +00:00
{% partial 'newHome/right-sidebar.htm' class="article-aside" %}
2022-12-06 15:33:01 +00:00
</div>
</div>
</main>
{% put scripts %}
2022-12-23 09:55:31 +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>
2022-12-06 15:33:01 +00:00
<script src="{{'assets/new/scripts/core/article.js'|theme}}"></script>
{% endput %}