Forum Moderators: coopster
This is a sentence. -- PERSON'S NAME -- RESORT NAME
This is a sentence 2. -- PERSON'S NAME 2 -- RESORT NAME 2 $resortname = "Chunky Monkey";
$f_contents = file_get_contents("testimonials.txt"); //get the entire file
$line = explode("\n",$f_contents); //explode (create an array) seperated by new line elements
$ntotalresorts = count($line); //gives me a TOTAL count.. maybe for later use
shuffle($line); //suffles up the array to randomize the contents
$neachresort = 0;
$firstSection = true;
foreach ($line as $str ){ //go through each array
$rawtestimonial = explode("--",$str); //chop up each line of the file, exploding at -- marks
$arrTestimonial = array_map('trim', $rawtestimonial); //TRIM IT, get rid of white space before and after each element
unset($str);
if ($arrTestimonial[2] == $resortname) { //Display only testimonials from a certain resort name
if ($firstSection) $firstSection = true; else echo '<br/>';
echo '<div class="rateyearheader">' . Giggity . '</div><br/>';
echo "<div class=\"bubble\">\n<div class=\"rounded\">\n<blockquote><p>" . $arrTestimonial[0] ."</p></blockquote></div> \n";
echo "<cite class=\"rounded\"><div><strong>" . $arrTestimonial[1] . "</strong> staying at " . $arrTestimonial[2] . "</div></cite>\n</div> \n\n";
echo $neachresort;
}
}