Location: PHPKode > scripts > AmaroK Web Frontend > obsidianmusic-2.3.0/pages/abc.php
<?php

//
//  ObsidianMusic
//   a.k.a. amaroK Web Frontend 2.0
//
//  Created 12/26/05
//   Copyright (C) Ryan Loebs (ObsidianX) 2005/2006
//   See LICENSE for GPL
//
//  abc.php - Alphabetical Sort
//
///////////////////////////////////////

if(eregi("abc.php", $_SERVER['PHP_SELF'])){
	die("Cannot access directly.");
}

// Set a default letter if none chosen
if(@$_GET['letter']){
	$currentl = urldecode($_GET['letter']);
}else{
	$currentl = "A";
}

// Load the query and execute it
if($currentl == "#"){
	$q = query(getquery("abc", $sort, $localregexp));
}else{
	$q = query(getquery("abc", $sort, $currentl));
}

// Convert to a usable array for patTemplate
$rows = getSongArray($q);

// Populate some variables
$tpl->addVar("root", "title", _PG_ABC);
$tpl->addVar("songs", "page", _PG_ABC);
$tpl->addVar("songs", "letter", $currentl);

// Load the ABC template
$tpl->setAttribute("songs", "src", "abc.tpl");
$tpl->loadTemplate("songs");

// Set the current active letter as bold
foreach($localabc as $key=>$value){
	if($value == $currentl){
		$letterb = "<b>$value</b>";
	}else{
		$letterb = $value;
	}
	$abcf[] = array('letter' => urlencode($value),
			'letterb' => $letterb);
}

// Fill up the letters box
$tpl->addRows("letter", $abcf);

// Populate the results
$tpl->addRows("row", $rows);
Return current item: AmaroK Web Frontend