Files
shopPRO/autoload/front/view/class.Articles.php
2024-10-23 13:44:50 +02:00

90 lines
2.5 KiB
PHP

<?php
namespace front\view;
class Articles
{
public static function news( $page_id, $articles )
{
$tpl = new \Tpl;
$tpl -> page_id = $page_id;
$tpl -> articles = $articles;
return $tpl -> render( 'articles/news' );
}
public static function full_article( $article_id, $lang_id )
{
$tpl = new \Tpl;
$tpl -> article = \front\factory\Articles::article_details( $article_id, $lang_id );
return $tpl -> render( 'articles/article' );
}
public static function miniature_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
{
$tpl = new \Tpl;
$tpl -> article = \front\factory\Articles::article_details( $article, $lang_id );
$out .= $tpl -> render( 'articles/article-miniature' );
}
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
$tpl -> ls = $results['ls'];
$tpl -> bs = $bs ? $bs : 1;
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
public static function entry_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
$articles[] = \front\factory\Articles::article_details( $article, $lang_id );
$tpl = new \Tpl;
$tpl -> page_id = $page['id'];
$tpl -> articles = $articles;
$out .= $tpl -> render( 'articles/articles-entries' );
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
$tpl -> ls = $results['ls'];
$tpl -> bs = $bs ? $bs : 1;
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
public static function full_articles_list( $page, $lang_id, $bs = 1 )
{
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
{
$tpl = new \Tpl;
$tpl -> article = \front\factory\Articles::article_details( $article, $lang_id );
$out .= $tpl -> render( 'articles/article-full' );
}
if ( $results['ls'] > 1 )
{
$tpl = new \Tpl;
$tpl -> ls = $results['ls'];
$tpl -> bs = $bs ? $bs : 1;
$tpl -> page = $page;
$out .= $tpl -> render( 'site/pager' );
}
return $out;
}
}