I am using a borrowed piece of code to display some pictures and their descriptions in a web page, at least that is the goal. The problem is that only the first character of the string is being displayed. I have inserted the “print_r()” function at the end of my code to try to help debug but am not seeing the coding malfunction. I can see as the result of “print_r()” that the array is what I expect which leads me to look in the second “echo” argument of the “foreach ($files as $file)” loop but cannot see what or where the problem is. While a direct answer would solve my issue a more useful answer would be what to look at or for so I can better learn the error and (hopefully) how to aviod it in the future. Below is the portion of the code in question.
Thank you
ikan
[php]<?php
$thumbs = “…/illustrations/Origional_Photos_Here/a_bunch_of_cut_ups/TH_cu_set_1/”; # location of small images used
$pics = “CU_set_1/”; # subdir of TH_cu_set_1, location of full size images
$cols = 5;
$pic_text = “C:/Theme_Time_Web_Pages/htdocs/illustrations/Origional_Photos_Here/a_bunch_of_cut_ups/CU_names_1.txt”; # a CSV of image names and their descriptions in the format of “picture_name.jpg,picture description as repeate of picture name”
$fh=fopen($pic_text, “r”);
while(!feof($fh))
{
$line=fgets($fh);
$temp = explode(",", $line);
$description [$temp[0]] = $temp[1];
unset($temp);
}
if ($handle = opendir($thumbs))
{
while (false !== ($file = readdir($handle)))
{
if ($file != “.” && $file != “…” && $file != $pic_text && $file != rtrim($pics,"/" ))
{
$files[] = $file;
}
}
closedir($handle);
}
$colCtr = 0;
echo ‘
’ . $description[$file][0] . ‘ | ’;
print_r ($description)."
";
?>[/php]