Location: PHPKode > scripts > Impleo Music Collection Script > impleo/templates/index.tpl
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
  <title>{if $isSearch}Search: {$query} - {/if}{$collectionName}</title>
  <link href="style.css" rel="stylesheet" type="text/css" media="screen">
  <script type="text/javascript" src="./ajax/prototype.js"></script>
  <script type="text/javascript" src="./ajax/AutoComplete.js"></script>
  <script type="text/javascript">  
  {literal}function disableKey(evt)
  {
    var evt  = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type=="text")) { return false; }
  }
  function setTerm(select)
  {
    window.ac.action =  './ajax/ac.php?t=' + select.value + '&s=';
  }{/literal}
  </script>
</head>
<body>
<h1>{$collectionName}</h1>
<ul>
  <li><a href="./">Main</a></li>
  <li><a href="./statistics.php">Statistics</a></li>
</ul>
{if $numRecords > 0}
<form action="{$uri}" method="get">
<p>
  <label for="q">Search: </label>
  <select name="term" id="term" onchange="setTerm(this)">
    <option value="artist"{if $isSearch && $selectedTerm eq 'artist'} selected{/if}>Artist</option>
    <option value="title"{if $isSearch && $selectedTerm eq 'title'} selected{/if}>Title</option>
    <option value="year"{if $isSearch && $selectedTerm eq 'year'} selected{/if}>Year</option>
	{foreach from=$details item=add}
	{if $add.show_in_table}
	<option value="{$add.key}"{if $isSearch && $selectedTerm eq $add.key} selected{/if}>{$add.name}</option>
	{/if}
	{/foreach}
  </select>
  <input type="text" name="q" id="q" onkeypress="return disableKey(event);"{if $isSearch} value="{$query}"{/if}>  
  <script type="text/javascript">
    {literal}var term = document.getElementById('term');
    window.ac = new AutoComplete('q', './ajax/ac.php?t=' + term.value + '&s=',{delay: .25, threshold: 1});{/literal}
  </script>
  <input type="submit" value="Search">
</p>
</form>
<table border="1" id="collection">
  <caption>{if $isSearch}Search on '{$query}' returned {$numRecords} result{if $numRecords ne 1}s{/if}{else}{$numRecords} records ({$numArtists} artists).{/if}</caption>
  {if $numRecords > 0}
  <thead>
    <tr>
      <th id="artist"><a href="?sort=artist&amp;order={$sortorder.artist}{if $isSearch}{$searchUrl}{/if}" title="Sort by artist">Artist</a></th>
      <th id="title"><a href="./?sort=title&amp;order={$sortorder.title}{if $isSearch}{$searchUrl}{/if}" title="Sort by title">Title</a></th>
      <th id="year"><a href="?sort=year&amp;order={$sortorder.year}{if $isSearch}{$searchUrl}{/if}" title="Sort by year">Year</a></th>
	  {foreach from=$details item=info}
	  {if $info.show_in_table}  
      <th id="{$info.key}"><a href="?sort={$info.key}&amp;order={$sortorder[$info.key]}{if $isSearch}{$searchUrl}{/if}" title="Sort by {$info.name|lower}">{$info.name}</a></th>
	  {/if}  
      {/foreach}
    </tr>
  </thead>
  <tbody>
{foreach from=$musiclist item=musicItem}  
    <tr>
      <td headers="artist">{$musicItem->getArtist()}</td>
      <td headers="title">{if $link}<a href="./record.php?id={$musicItem->getId()}">{/if}{$musicItem->getTitle()}{if $link}</a>{/if}</td>
      <td headers="year">{$musicItem->getYear()}</td>
      {foreach from=$musicItem->getDetailInfo() key=k item=item name=ext}
	  {if $details[$smarty.foreach.ext.index].show_in_table}<td headers="{$k}">{$item}</td>{/if}
	  {/foreach}
    </tr>
{/foreach}
  </tbody>
  {/if}
</table>
{if $showPaging}
<p id="navigation">
{if $paging[0]}<a href="./{$paging[0]}">Previous</a>{else}Previous{/if}
{foreach from=$paging[1] item=link name=plink}
  {if $link}<a href="./{$link}">{/if}{$smarty.foreach.plink.index+1}{if $link}</a>{/if}
{/foreach}
 {if $paging[2]}<a href="./{$paging[2]}">Next</a>{else}Next{/if}
</p>
{/if}
{else}
<p>There are currently no records in the collection.</p>
{/if}
<p id="author"><a href="http://sappy.dk/impleo/">Impleo Music Collection 2.0</a></p>
</body>
</html>
Return current item: Impleo Music Collection Script