summaryrefslogtreecommitdiff
path: root/pages/lyrics.php
blob: 50ce6719c7f22df93f75a3d97e9ee49c9337f26a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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";

?>