Jukebox/w3tpl: Difference between revisions

From HypertWiki
field name was wrong in album sql
got title listing working
Line 6: Line 6:
=====================
=====================
<func GetArtists>
<func GetArtists>
   <for db=audioferret table="Artists" sort="sort, name" name=ar>
   <for db=audioferret table="qryArtists_index" sort="name" name=ar>
     <let name=ar_name val="@row.ar.name" />
     <let name=ar_name val="@row.ar.name" />
     <let name=outFunc append>
     <let name=outFunc append>
Line 23: Line 23:
     <let name=outFunc append>
     <let name=outFunc append>
* </let>
* </let>
    <let name=outFunc append vars>[{{fullurl:{{PAGENAME}}|artist=[$doArtist$]&album=[$@row.al.id$]}} </let>
     <let name=outFunc append copy=al_name />
     <let name=outFunc append copy=al_name />
    <let name=outFunc append>]</let>
  </for>
</func>
<func GetTitles>
  <if flag=doAlbum>
    <let name=sqlFilt vars>album_id=</let>
    <let name=sqlFilt append copy=doAlbum />
  </if><else>
    <let name=sqlFilt vars>artist_id=</let>
    <let name=sqlFilt append copy=doArtist />
  </else>
  <for db=audioferret table="Titles" where=$sqlFilt sort="track, name" name=ti>
    <let name=outFunc append>
* '''</let>
    <let name=outFunc append copy=@row.ti.track />
    <let name=outFunc append>'''. </let>
    <let name=outFunc append copy=@row.ti.name />
   </for>
   </for>
</func>
</func>
Line 33: Line 52:


Get the input arguments:
Get the input arguments:
<let name=doArtist copy=@query.artist />
<!-- let name=doArtist copy=@query.artist / -->
<let name=doAlbum copy=@query.album />
<let name=doArtist val=5 />
<!-- let name=doAlbum copy=@query.album / -->
<let name=doAlbum val=79 />


Always show the artists:
Always show the artists:
Line 56: Line 77:
|
|
</let>
</let>
<let name=out append copy=outFunc />
<let name=out append copy=outFunc />
<let name=outFunc null />
<if flag=doArtist>
<if flag=doArtist>
   <call GetAlbums />
   <call GetAlbums />
   <let name=out append> || </let>
   <let name=out append>
| valign=top | </let>
  <let name=out append copy=outFunc />
  <let name=outFunc null />
</if>
 
<if flag=doTitles>
  <call GetTitles />
  <let name=out append>
| valign=top | </let>
   <let name=out append copy=outFunc />
   <let name=out append copy=outFunc />
  <let name=outFunc null />
</if>
</if>
<let name=out append>
<let name=out append>
|}</let>
|}</let>

Revision as of 22:49, 8 March 2009

The Hypertwin Jukebox

is under construction, but here are all the artists <hide>

=========
functions
=========

<func GetArtists>

 <for db=audioferret table="qryArtists_index" sort="name" name=ar>
   <let name=ar_name val="@row.ar.name" />
   <let name=outFunc append>
  • </let>
   <let name=outFunc append vars>[$@row.ar.id$ </let>
   <let name=outFunc append copy=ar_name />
   <let name=outFunc append>]</let>
 </for>

</func>

<func GetAlbums>

 <let name=sqlFilt vars>idartist=</let>
 <let name=sqlFilt append copy=doArtist />
 <for db=audioferret table="Albums" where=$sqlFilt sort="sort, name" name=al>
   <let name=al_name val="@row.al.name" />
   <let name=outFunc append>
  • </let>
   <let name=outFunc append vars>[$doArtist$&album=[$@row.al.id$] </let>
   <let name=outFunc append copy=al_name />
   <let name=outFunc append>]</let>
 </for>

</func>

<func GetTitles>

 <if flag=doAlbum>
   <let name=sqlFilt vars>album_id=</let>
   <let name=sqlFilt append copy=doAlbum />
 </if><else>
   <let name=sqlFilt vars>artist_id=</let>
   <let name=sqlFilt append copy=doArtist />
 </else>
 <for db=audioferret table="Titles" where=$sqlFilt sort="track, name" name=ti>
   <let name=outFunc append>
  • </let>
   <let name=outFunc append copy=@row.ti.track />
   <let name=outFunc append>. </let>
   <let name=outFunc append copy=@row.ti.name />
 </for>

</func>

================
build the output
================

Turn off page cache: <w3tpl nocache />

Get the input arguments: <let name=doArtist val=5 /> <let name=doAlbum val=79 />

Always show the artists: <call GetArtists />

<let name=out>

Artists</let>

<if flag=doArtist>

 <let name=doTitles val=1 />

</if> <if flag=doArtist>

 <let name=out append> || Albums</let>

</if> <if flag=doTitles>

 <let name=out append> || Titles</let>

</if> <let name=out append>

</let>

<let name=out append copy=outFunc /> <let name=outFunc null />

<if flag=doArtist>

 <call GetAlbums />
 <let name=out append>
</let>
 <let name=out append copy=outFunc />
 <let name=outFunc null />

</if>

<if flag=doTitles>

 <call GetTitles />
 <let name=out append>
</let>
 <let name=out append copy=outFunc />
 <let name=outFunc null />

</if>

<let name=out append>

</let>

===============
show the output
===============

</hide><get name=out />