Created
January 10, 2014 00:23
-
-
Save corbanb/8344720 to your computer and use it in GitHub Desktop.
Output CSV data into HTML with this simple script.
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 | |
ini_set('auto_detect_line_endings',TRUE); | |
$handle = fopen("mydata.csv", "r"); | |
?> | |
<ul> | |
<?php while ( ($data = fgetcsv($handle, 1000, ",")) !== FALSE ): ?> | |
<li> | |
<a href="<?= $data[4] ?>" class="product-container"> | |
<img class="lazy" src="<?= $data[3] ?>" data-original="<?= $data[3] ?>"> | |
<div class="post-details"> | |
<p class="company"><?= $data[2] ?></p> | |
<h4><?= $data[0] ?></h4> | |
<p class="price">$<?= $data[1] ?></p> | |
<div href="#" class="buy-button"></div> | |
</div> | |
</a> | |
</li> | |
<?php endwhile; ?> | |
<?php fclose($handle); ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment