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

125 lines
3.6 KiB
HTML

title = "new/afisha-post"
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
==
<?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']);
}
?>
==
{% put styles %}
<style>
p img {
width: 100%;
}
</style>
{% endput %}
{% 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">
<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 %}
{% if post.afisha_address %}
<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 %}
<div class="affiche-item-data-row">
<div class="affiche-item-data-img">
<img src="{{'assets/new/icons/eye.svg'|theme}}" alt="" />
</div>
<span>1938</span>
</div>
</div>
</div>
<div class="affiche-item-img">
{% if post.featured_image %}
<img src="{{post.featured_image|media}}" alt="{{post.title}}" />
{% endif %}
</div>
</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 %}
<script src="{{'assets/new/scripts/core/affiche-item.js'|theme}}"></script>
{% endput %}