Edicions Anteriores

Rallye Moucho do Condado

<?php
//See http://www.austinsms.org/newsletter.php 
//Reads all the newsletter subfolders ("2016", "2015", etc.) and shows list of allavailable issues along with thumbnails in JPEG subfolder.
//This does not actually create the thumbnails.

$news_folders = scandir('/images/Ediciones_Anteriores_Rally', 2); //News subfolders in DESC order
$year_links;
$news_blocks;

foreach ($news_folders as $folder)
{
	if (strlen($folder) > 2)
	{
		$year_links.= '<a href="#' . $folder . '">' . $folder . '</a> '; //Create Years link list
		$news_blocks.= '<div class="YearBlock"><p class="NewsYear"><a name="' . $folder . '"></a>' . $folder . '</p>' . "\r\n"; //Create Newsletter blocks by year
		$newsletters = scandir('news/' . $folder); //Get list of newsletters for this year
		usort($newsletters, "compare_months"); //Sort list of newsletters using compare_months function
		foreach ($newsletters as $value)
		{
			if ((strlen($value) > 2) && ($value != 'JPEG'))
				{
    	  			$news_anchor = '<a href="/news/' . $folder . '/' . $value . '" target="_BLANK">';
    	  			$news_blocks.= '<div class="SingleNews">' . $news_anchor . substr($value, 0, -8) . '</a><br>' . "\r\n";
    	  			$news_blocks.= $news_anchor . '<img src="/news/'. $folder . '/JPEG/' . substr($value, 0, -4) . '.jpg"></a></div>' . "\r\n";
				}
		}
		$news_blocks.= '<p class="Divider"><hr></p></div>' . "\r\n";
	}		
}

function compare_months($a, $b) 
{
    $monthA = date_parse($a);
    $monthB = date_parse($b);
    return $monthA["month"] - $monthB["month"];
}
?>

<?php echo $year_links; ?>

<?php echo $news_blocks; ?>

Artígos relacionados