Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

Making an Array from a String and Looping the New Array

//make array function
function explode_to_array($text) {
if ($text) {
$_arr = explode(“,”, $text);
if ($_arr)
$_arr = array_map(“trim”, $_arr);
return $_arr; } return false; }
//string $imgNames = “one,2,3,4”;
$imgCaptions = “caption1,caption2,caption3,caption4”;
$imgLinks = “link1,link2,link3,link4”;
//make an array from the string
$imgs = explode_to_array($imgNames);
// get images ALTs array $caps = explode_to_array($imgCaptions);
//get images links array $links = explode_to_array($imgLinks);
// construct images content
$i = 0;
if ($imgs) {
foreach ($imgs as $item) { 
if ($i >0) $class = ” class = ‘hide_images'”;
$slideshow_content =”<div $class><a href='”.$links[$i].”‘><img src='”.$imgFolder.$item.”‘ alt='”.$caps[$i].”‘ width=’$modwidth’ height=’$modheight’/></a><p >”.$caps[$i].”</p></div>”;
        $i++;
    }
    }

<div id=”bogallery”>
       
             <?php echo $slideshow_content;  ?>           
       
  </div>