<?

////////////////////////////////
$EnforceSession = false;
include "includes/includes.php";
////////////////////////////////

// Header
include "includes/header.php";

// Begin Template
$tp = new PhpTemplate;
for( $tp->StartFromFile( "templates/faq.template" ); $tp->NextAndEchoOutput(); ) 
{

	CheckGlobalEscapes( $tp );	
	
	if( $tp->IsEscape("LESSONS") )
	{
	
		// Connect
		$db = mysql_connect("localhost", $gblMySqlUser, $gblMySqlPass);
		mysql_select_db($gblMySqlDb, $db);
		
		// Retrieve data
		$query = "SELECT name FROM lesson WHERE site = '" . $gblSiteName . "' ORDER BY number";
		$result = mysql_query($query, $db);
								
		// Loop results
		for( $RowIndex = 0; $a = mysql_fetch_array($result); $RowIndex++ )
		{
			$Record = new PhpSqlRow;
			$Record->SetAsArray($a);
								
			$tpElem = new PhpTemplate;						
			for( $tpElem->Start( $tp->GetEscapeArgument() ); $tpElem->NextAndEchoOutput(); ) 
			{							
				if( $tpElem->IsEscape("INDEX") ) echo $RowIndex + 1;
				else if( $tpElem->IsEscape("NAME") ) echo $Record->GetValue("name");
			}
			
		}			
	
	}
	
}

// Footer
include "includes/footer.php";

?>