<? global $lang, $config, $settings;?>
<div id="news">
  <div class="news_head">
    <?= \front\view\Scontainers::scontainer( 15 );?>
  </div>

  <div class="content">
    <? foreach ( $this -> articles as $article ):?>
    <div class="article">
      <? $article[ 'language' ][ 'seo_link' ] ? $url = $article[ 'language' ][ 'seo_link' ] : $url = 'a-' . $article[ 'id' ] . '-' . \S::seo( $article[ 'language' ][ 'title' ] );?>
      <div class="article-content">
        <a href="/<? if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language( \S::get_domain( $_SERVER[ 'HTTP_HOST' ] ) ) ) echo \S::get_session( 'current-lang' ) . '/';?><?= $url;?>" class="main-image" rel="nofollow">
          <img src="<?= $article['language']['main_image'] ?>" alt="image">
        </a>
        <div class="article-content-data">
          <a href="/<? if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language( \S::get_domain( $_SERVER['HTTP_HOST'] ) ) ) echo \S::get_session( 'current-lang' ) . '/';?><?= $url;?>" title="<?= $article['language']['title'];?>" class="title">
            <?= $article['language']['title'];?>
          </a>
          <?php
              if ( $article['show_date_add'] )
              echo '<div class="date-add"> <img src="/images/icon/icon-date.svg" alt=""> ' . date( "d/m/Y", strtotime( $article['date_add'] ) ) . '</div>';
            ?>

          <div class="entry">
            <?
            $content = strip_tags($article[ 'language' ][ 'entry' ]);
            if (strlen($content) > 100) {
                // truncate string
                $contentCut = substr($content, 0, 100);
                $endPoint = strrpos($content, ' ');

                //if the string doesn't contain any space then it will cut without word basis.
                $content = $endPoint? substr($contentCut, 0, $endPoint) : substr($contentCut, 0);
                $content .= '...';
            }
            echo $content;
            ?>
          </div>
          <a class="more" href="/<? if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language( \S::get_domain( $_SERVER[ 'HTTP_HOST' ] ) ) ) echo \S::get_session( 'current-lang' ) . '/';?><?= $url;?>" title="<?= $article[ 'language' ][ 'title' ];?>" rel="nofollow">
            <?= $lang['Zobacz artykul'];?>
          </a>
        </div>
      </div>
    </div>
    <? endforeach;?>
  </div>
  <div class="news_bottom">
    <a href="/blog" class="btn-2"><?= $lang['Zobacz wszystkie'];?></a>
  </div>
</div>