TDH_2/themes/demo/pages/home.htm

83 lines
2.8 KiB
HTML
Raw Normal View History

2023-05-09 11:26:47 +00:00
title = "TDH"
url = "/old"
layout = "default"
meta_title = "TDH"
meta_description = "Türkmenistanyň soňky habarlary, daşary ýurt täzelilkleri, syýasy, ykdysadyýet, jemgyýet, sport, medeniýet habarlary."
is_hidden = 0
[viewBag]
localeUrl[en] = "/"
localeUrl[ru] = "/"
localeMeta_description[ru] = "Свежие новости Туркменистана, последние новости из-за рубежа, новости политики, экономики, общества, спорта, культуры."
localeMeta_description[en] = "The latest news of Turkmenistan, world news, politics, economy, society, sport, culture news."
[newsPosts]
pageNumber = "{{ :page }}"
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "published_at desc"
postFeatured = 0
postPage = "home"
categoryPage = "home"
==
<?php
use RainLab\Translate\Classes\Translator;
protected $translator;
function onStart()
{
$this['currentLanguage'] = $this->activeLocale;
$this->translator = Translator::instance();
$this['SelectedLanguage'] = $this->activeLocale = $this->translator->getLocale();
2023-05-10 06:46:17 +00:00
// featured news
$featured = \Indikator\News\Models\Posts::where("featured", true)
->where("locale", App::getLocale())->where("status", 1)
->orderBy('published_at', 'desc')
->get()->first();
$this['postFeatured'] = $featured;
2023-05-09 11:26:47 +00:00
if($featured->image){
$this['imageType'] = $featured->image[0]["type"];
}
// end featured news
// last news
2023-05-10 06:46:17 +00:00
$this['lastNews'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())->where("status", 1)
->where("category_id", "!=", $this->theme->colleagues_news)
->whereNotIn('category_id', [20,21,22])
->orderBy('published_at', 'desc')
->limit(10)->get();
2023-05-09 11:26:47 +00:00
// end last news
2023-05-10 06:46:17 +00:00
// collegue News
$this['collegueNews'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())
->where("status", 1)
->where("category_id", $this->theme->colleagues_news)
->orderBy('published_at', 'desc')
->limit(9)->get();
2023-05-09 11:26:47 +00:00
$this["collegueNews_cat"] = \Indikator\News\Models\Categories::where("id", $this->theme->colleagues_news)->first();
2023-05-10 06:46:17 +00:00
// end collegue News
2023-05-09 11:26:47 +00:00
// intro news 3rd column
2023-05-10 06:46:17 +00:00
$this['intro_cat_news'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())
->where("status", 1)
->where("category_id", $this->theme->intro_cat_news)
->orderBy('published_at', 'desc')->limit(10)->get();
2023-05-09 11:26:47 +00:00
$this["intro_cat"] = \Indikator\News\Models\Categories::where("id", $this->theme->intro_cat_news)->first();
// end intro new
2023-05-10 06:46:17 +00:00
2023-05-09 11:26:47 +00:00
}
?>
==
{% set CurrentLanguage = SelectedLanguage %}
{% partial 'home_intro' %}
2023-05-10 06:46:17 +00:00
<!-- partial 'year_category' -->
2023-05-09 11:26:47 +00:00
{% partial 'home_categories' %}
2023-05-10 06:46:17 +00:00
{% partial 'home_media' %}