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();

    // 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;
    if($featured->image){
        $this['imageType'] = $featured->image[0]["type"];
    }
    // end featured news

    // last news
    $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();
    // end last news


    // 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();

    $this["collegueNews_cat"] = \Indikator\News\Models\Categories::where("id", $this->theme->colleagues_news)->first();
    // end collegue News

    // intro news 3rd column
    $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();

    $this["intro_cat"] = \Indikator\News\Models\Categories::where("id", $this->theme->intro_cat_news)->first();
    // end intro new

}
?>
==
{% set CurrentLanguage = SelectedLanguage %}

{% partial 'home_intro' %}
<!--  partial 'year_category' -->
{% partial 'home_categories' %}
{% partial 'home_media' %}
