Created
May 31, 2013 00:43
-
-
Save vsync/5682314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$filename = 'leikkikentta.csv'; // viestitiedosto | |
if(!file_exists($filename)) { | |
touch($filename); | |
// echo 'no comments'; voi muuttaa, tai jättää pois kokonaan | |
} | |
else { | |
$handle = fopen($filename, 'r'); | |
while (($data = fgetcsv($handle, 2048, ",")) !== FALSE) { // Luetaan tiedosto arrayhyn. | |
$rows[] = $data; | |
} | |
fclose($handle); | |
$rows = array_reverse($rows); // Kaannetaan array ympari ja tulostetaan se (uusin nakyy ensin) | |
foreach($rows as $data) { | |
?> | |
<div class="comment"> | |
<span class="msg"><?php echo $data[3]; ?></span> | |
<a href="mailto:<?php echo $data[1]; ?>"><span class="name"><?php echo $data[0]; ?></span></a><br> | |
<span class="url"><?php echo $data[2]; ?></span><br> | |
<span class="timestamp">[ <?php echo $data[4]; ?> ] + [ <?php echo $data[5]; ?> ]</span> | |
</div> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment