Last active
August 29, 2015 13:57
-
-
Save paulusm/9365556 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 | |
//open the file and decode the JSON into an Array | |
$contents = utf8_encode(file_get_contents("comments.json")); | |
$commentrecords = json_decode($contents, true); | |
//If we have comments, loop trhough them and create HTML list items for each | |
if($commentrecords){ | |
foreach($commentrecords as $commentrecord){ | |
echo "<li>" .$commentrecord["comment"] ; | |
echo "<br><strong>" . $commentrecord["name"] . "</strong></li>"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment