MovieDatabase/index.php

43 lines
1.2 KiB
PHP
Raw Normal View History

2016-05-22 14:58:34 +00:00
<?php include 'gori.php';?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<?php include 'header.php'; ?>
<div class="content">
2016-05-22 15:27:27 +00:00
<?php $newsFile = file($openShiftFolder."vijesti.csv");
2016-05-22 21:25:21 +00:00
$imagesArray = [];
$newsArray = [];
$timesArray = [];
$counter = 0;
foreach ($newsFile as $news) {
$nesto = str_getcsv($news);
2016-05-31 21:43:24 +00:00
if(count($nesto) < 3) continue;
2016-05-22 21:25:21 +00:00
$timesArray[$counter] = $nesto[0];
$imagesArray[$counter] = $nesto[1];
$newsArray[$counter] = $nesto[2];
$counter++;
}
if(isset($_POST['sort'])) {
if($_POST['sort']=='alpha') {
array_multisort($newsArray, SORT_STRING, $imagesArray, $timesArray);
}
}
for($i = 0; $i < $counter; $i++) {
?>
2016-05-22 14:58:34 +00:00
<div class="news">
<?php
2016-05-22 21:25:21 +00:00
$image = $imagesArray[$i];
$timeOfNews = $timesArray[$i];
$newsContent = $newsArray[$i];
2016-05-22 14:58:34 +00:00
?>
<img src="<?php echo (strlen($image)!=0)?$image:'no_image.png' ?>"/>
<p>
<time class='vrijeme' datetime="<?php echo $timeOfNews ?>"></time>
2016-05-31 21:49:27 +00:00
<?php echo $newsContent ?>
2016-05-22 14:58:34 +00:00
</p>
</div>
<?php
}?>
</div>
</BODY>
</HTML>