latest news

This commit is contained in:
Kerim 2023-02-17 11:39:53 +05:00
parent 3e5891a5af
commit fd1448175f
5 changed files with 60 additions and 57 deletions

View File

@ -230,14 +230,17 @@ class Posts extends ComponentBase
$featured = $this->property('featured') ? $this->property('featured')=='yes':null;
$morque = $this->property('morque') ? $this->property('morque')=='yes':null;
$posts = BlogPost::with(['categories'])->listFrontEnd([
// dump($this->property('typePost'));
$filters = [
'page' => $this->property('pageNumber'),
'sort' => $this->property('sortOrder'),
'perPage' => $this->property('postsPerPage'),
'featured' => $featured,
'morque' => $morque,
'typePost' => empty($this->property('typePost')) ? null : $this->property('typePost'),
// 'typePost' => empty($this->property('typePost')) ? null : $this->property('typePost'),
// 'typePost' => empty($this->property('typePost')) ? null : is_array($this->property('typePost'))
// ? $this->property('typePost')
// : preg_split('/,\s*/', $this->property('typePost'), -1, PREG_SPLIT_NO_EMPTY),
'postGroup' => empty($this->property('categoryGroup')) ? null : $this->property('categoryGroup'),
'search' => trim(input('q')),
'category' => $category,
@ -249,7 +252,15 @@ class Posts extends ComponentBase
'exceptCategories' => is_array($this->property('exceptCategories'))
? $this->property('exceptCategories')
: preg_split('/,\s*/', $this->property('exceptCategories'), -1, PREG_SPLIT_NO_EMPTY),
]);
];
if(!empty($this->property('typePost'))){
$filters["typePost"] = is_array($this->property('typePost'))
? $this->property('typePost')
: preg_split('/,\s*/', $this->property('typePost'), -1, PREG_SPLIT_NO_EMPTY);
}
$posts = BlogPost::with(['categories'])->listFrontEnd($filters);
//dd($this->property('categoryGroup'));
/*
* Add a "url" helper attribute for linking to each post and category

View File

@ -92,6 +92,9 @@ class StatisticsController extends Controller
$this->vars['reklam_stats'] = $stats->get();
dd($stats->get());
$this->vars['count_view'] = 30;
return ['#linechart' => $this->makePartial('linechart')];
}

View File

@ -8,14 +8,17 @@
google.charts.setOnLoadCallback(drawLineChart_<?=$id?>);
function drawLineChart_<?=$id?>(){
// var all = 20;
var data = google.visualization.arrayToDataTable([
['date', 'views', 'clicks',],
<?php foreach($reklam_stats->where('item_id',$id) as $stats):?>
['<?=date_format(date_create($stats->date),'m/d')?>', <?=$stats->view?>,<?=$stats->click?>],
['<?=date_format(date_create($stats->date),'m/d')?>', <?=$stats->view?>, <?=$stats->click?>],
<?php endforeach; ?>
]);
var options = {
title: '<?=$reklam?>',
title: '<?=$reklam?> <?=$count_view?>',
curveType: 'function',
legend: { position: 'bottom' }
};

View File

@ -19,7 +19,7 @@ default = 0
<html lang="{{ activeLocale }}">
<head>
{% partial 'new/head' %}
{% component 'SeoCmsPage' %}
{% styles %}
@ -32,29 +32,29 @@ default = 0
<section class="big-banner">
<!-- <a href="#"> -->
<picture>
{% component 'adverts'%}
</picture>
<!-- </a> -->
</section>
<!-- HEAD ======== -->
<header class="header">
<div class="container">
<div class="header-inner">
{% partial 'new/mobile-menu' %}
<div class="header-search-icon">
<img src="{{ 'assets/new/icons/search.svg'|theme}}" alt="" />
</div>
<div class="header-left">
<a href="/" class="header-logo">
<!-- <img src="{{ 'assets/images/newYearLogo.png'|theme}}" alt="" /> -->
@ -78,7 +78,7 @@ default = 0
</a>
</li>
{% endif %}
{% if this.theme.telegram %}
<li>
<a href="{{ this.theme.telegram }}">
@ -86,7 +86,7 @@ default = 0
</a>
</li>
{% endif %}
{% if this.theme.twitter %}
<li>
<a href="{{ this.theme.twitter }}">
@ -97,35 +97,35 @@ default = 0
</ul>
{% partial 'new/searchForm' %}
</div>
<div class="header-burger">
<img src="{{ 'assets/new/icons/burger.svg'|theme}}" alt="" />
</div>
</div>
</div>
</header>
{% partial 'newMenu/menu' %}
{% partial 'new/latest-news-mobile' %}
<!-- HEAD end ======== -->
{% page %}
{% partial 'new/footer' %}
<script src="{{ 'assets/new/jquery.js'|theme}}"></script>
<script src="{{ 'assets/new/scripts/swiper/swiper-bundle.min.js'|theme}}"></script>
<script src="{{ 'assets/new/copy.js'|theme}}"></script>
{% scripts %}
{% framework extras %}
<script src="{{ 'assets/new/copy.js'|theme}}"></script>
{% framework extras %}
{% scripts %}
<!-- javascript end
============================================= -->
<!-- Global site tag (gtag.js) - Google Analytics -->
@ -140,4 +140,4 @@ default = 0
</body>
</html>
</html>

View File

@ -2,30 +2,16 @@
[blogPosts]
pageNumber = "{{ :page }}"
typePost = "turkmenistan"
typePost = "turkmenistan, world"
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "created_at desc"
categoryPage = 404
postPage = 404
[blogPosts blogPosts2]
pageNumber = "{{ :page }}"
typePost = "world"
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "created_at desc"
categoryPage = 404
postPage = 404
==
<?php
function onStart(){
$this["merged"]=$this["blogPosts"]."qq";
}
?>
==
{% set posts = blogPosts.posts %}
{% set posts_world = blogPosts2.posts %}
{% set posts = blogPosts.posts %}
<!-- ASIDE MOBILE ============-->
@ -34,19 +20,19 @@ function onStart(){
<div class="aside-mobile-inner">
<h2 class="aside-mobile-header">{{ 'page.latest_news'|_ }}</h2>
<ul class="aside-mobile-items">
{% for post in posts %}
<li>
<a href="{{'new/newPost'|page({id:post.id,slug:post.slug})}}">
<div class="time">{{post.published_at|date('H:i')}}</div>
<p class="content">
{{merged}}
{{ post.title }}
</p>
</a>
</li>
{% endfor %}
<li>
<a href="/new/posts/news" class="aside-mobile-more">{{'new.read.more'|_}}</a>
@ -57,4 +43,4 @@ function onStart(){
</button>
</div>
</section>
<!-- ASIDE MOBILE end ============ -->
<!-- ASIDE MOBILE end ============ -->