<?php
/*
{
	"id" : "article-container",
	"name": "Article Folder",
	"category": "container"
}
*/

if (!is_file(__DIR__ . "/article-container.html")
	|| !is_file(__DIR__ . "/article-card.html"))
	exit( pathinfo(__FILE__, PATHINFO_FILENAME) . ": template not found." );

$posts					= $sw->type("article")->limit(24)->posts();
$posts					= (new ComponentModule())->data($posts, "1:1")->markupFile( __DIR__ . "/article-card.html" );

$container_markup				= file_get_contents(__DIR__ . "/article-container.html");

$content				= strtr(
		$container_markup,
		array(
				"<!--title-->"										=> $result["title"],
				"<!--context-->"									=> $result["context"],
				"<!--cards_main_article-->"				=> $posts->cards(),
				"<!--pagination-->"							=> $posts->pagination(),
		)
);


$SiteShell->replace('article', PHP_EOL . $content);
$SiteShell->render();

