"; /* $search_a = ""; currently set to not searching */ /* Cat Turhan president at WarwickSU 2015 */ $search_cat = ""; $search_nm = 1234567; // Further development - Simplify this to a multidimensional array. $matches_h = array(); $matches_p = array(); $matches_a = array(); $matches_cat = array(); $matches_nm = array(); // Further development - Simplify this to a multidimensional array. $handle = @fopen("htmlpg.html", "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); if(strpos($buffer, $search_h) !== FALSE) $matches_h[] = $buffer; if(strpos($buffer, $search_p) !== FALSE) $matches_p[] = $buffer; if(strpos($buffer, $search_a) !== FALSE) $matches_a[] = $buffer; if(strpos($buffer, $search_cat) !== FALSE) $matches_cat[] = $buffer; if(strpos($buffer, $search_nm) !== FALSE) $matches_nm[] = $buffer; } fclose($handle); } // Further development - Using library assets such as strip_tags, preg_replace, with an array instead of parsing array cells to single variables. // Notes - Iterate through an array of

tags, to assess each individual content field. for ($i = 0; $i < count($matches_h); ++$i) { // ** Further development ** : Parsing data from the array's to be manipulated as single variables is unnecessary. $text_h = $matches_h[$i]; $text_p = $matches_p[$i]; $text_a = $matches_a[$i]; $img_name = strip_tags($text_h); //Notes - Remove the

tag, remove any formatting or character spaces and included the img file extension. $image_name_file = strip_tags($text_h); $image_name_file = preg_replace('/\s+/', '', $image_name_file); $image_name_file = preg_replace("/[^a-zA-Z0-9]+/", "", $image_name_file); $image_name_file = $image_page.$image_name_file.'.jpg'; // Notes - Looks for whether or not to include the tracking code dependent on the URL. $url = strip_tags($text_a); if (strpos($url,'warwicksu.com') !== false ) { $url = strip_tags($text_a).$tracking; $url = preg_replace('/\s+/', '', $url);} // Notes - Publishes basic HTML to the browser including URL, tracking code, title and paragraph content. echo '
'; $img_alt = strip_tags($text_h); echo ""; echo "\"$img_alt\""; echo ''; echo '

'; echo strip_tags($text_p, ''); echo '

'; echo ''; } ?>