Code with C | Programming: Projects & Source Codes › Forums › HTML/CSS › How to loading multiple images with minimal code
I have a website with a lot of images, in kind of a tiled layout, it is a catalog of movies, each time a new movie comes up i update it, I also make the image a link to the IMDB review page. as you can imagine this is a lot of code, here is the code I am using:
<a href="http://www.imdb.com/title/tt0848228/" rel="nofollow">
<img src="images/Avengers.jpg" height="220px" width="165px" /></a>
obviously I am using css, however I don’t think you need worry about that as my only issue is, I want to be able to use (ASP I THINK) in order to load multiple images just using that one piece of code.
i think i may run into problems as i will also need a new IMDB link into the code, which has to be linked to the image obviously.
i am in need of help because i have a catalog of around 200 movies, and recently i deleted around 175 of these code segments and accidentally saved it and have no way of retrieving a back up.
I would look into creating a CSV file of all the movies. So the CSV would be :
movie_title, movie_image, movie_imdb_link
Repeat a line like this for all 200 movies
I’m a php developer so I would use that.. but it requires a server running php .. so might not be ideal but it then has a function ‘fgetcsv’.
Which you can use something like:
$file = fopen("movie_file.csv","r");
$movie = fgetcsv($file);
echo '<div class="new_prod_box">';
echo '<div class="new_prod_bg"> ';
echo '<a href="' . $movie . '" rel="nofollow"> '; //$movie == 3rd value in each csv row == imdb link
echo '<img src="images/' . $movie . '" height="220px" width="165px" /></a> '; //$movie == 2nd value in each csv row == image link
That’s one quick example – its all untested but should work.
You must be logged in to reply to this topic.