diff options
Diffstat (limited to 'pages/lyrics.php')
-rw-r--r-- | pages/lyrics.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pages/lyrics.php b/pages/lyrics.php new file mode 100644 index 0000000..50ce671 --- /dev/null +++ b/pages/lyrics.php @@ -0,0 +1,35 @@ +<?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"; + +?> |