<?php global $name; $filename = $DATA_DIR . "/lyrics/" . $name . ".txt"; $fp = fopen($filename, "r"); $file = fread($fp, filesize($filename)); fclose($fp); $blocks = explode("\n\n", $file); foreach ($blocks as $block) { $lines = explode("\n", $block); $pset = false; if($title) { echo "<p>\n"; $pset = true; } foreach ($lines as $line) { if(!$title) { $title = $line; echo "<div class=\"small_header\">" . $title . "</div>\n"; } else { echo $line . "<br/>\n"; $line = strtok("\n"); } } if($pset) echo "</p>\n"; } echo "<p>\n"; //echo "<a target=\"newwindow\" href=\"". $filename . "\">Download</a>\n"; echo "</p>\n"; ?>