Hi, newbie here,
Trying to reuse a free HTML template but I need to include a bit of source code and I have no clue how to do so. Can anyone help me?
Got an external CSV file (data.txt) as a database:
“img_01.jpg”, “Name of photo or title here”
“img_02.jpg”, “Name of photo or title here”
“img_03.jpg”, “Name of photo or title here”
and I need to create a recursive load in a HTML page repeating this piece of code as many times as rows there are in the above CSV file:
<div class="grid-item item animate-box" data-animate-effect="fadeIn"> <a href="images/img_XX.jpg" class="image-popup" title="Name of photo or title here"> <div class="img-wrap"> <img src="images/img_XX.jpg" alt="" class="img-responsive"> </div> <div class="text-wrap"> <div class="text-inner popup"> <div> <h2>Name of photo or title here</h2> </div> </div> </div> </a> </div>
I am thinking in some kind of PHP within the HTML (<?php.... ?>) that would read the length of the CSV file (number of rows) into a variable (number of iterations) and then a loop sequence (if, then, else style) copying the above HTML code so many times.
The problem is that last time I programmed was 20 years ago, and I have no clue of “modern” languages. I would think this should be a very straightforward coding that shouldn’t take anyone knowledgeable on PHP more than ten minutes, am I right? Can anyone spare those 10 minutes and help me out?
Thanks a lot.