Latest Register Log In

+ Advanced Search

Allowing End Users to Change Toplists

Allowing End Users to Change Toplists
By
Jul 14, 2009 (Edited Mar 10, 2014)

Sometimes you may want to let users decide what sort of toplist to view. Take the toplist in your main index template, for example:
<form action="index.php" style="margin: 0px; padding: 0px;">
<div class="box">
<div class="boxtitle" onclick="minmax('topbox')"><img src="{IMAGESURL}/icon_show.gif" > Top {TOPLISTTOTAL1} Links</div>
<div class="boxbody" id="topbox">
Show
<select name="number[1]">
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
</select>
<select name="thefield[1]">
<option value="time">newest</option>
<option value="rating">top rated</option>
<option value="hits">most visited</option>
</select>
<input type="submit" value="Go" class="button" >
<br >
<!-- BEGIN TOPLIST 1 -->
<CONFIG>links[,]time[,]5[,]descending</CONFIG>
{NUMBER}. <a href="{TRACKLINKURL}" class="newlinks" {EXTERNALLINKS}>{LINKTITLE}</a> {LINKADMIN}
<br >
<!-- END TOPLIST 1 -->
</div>
</div>
</form>


To add an alphabetical option, add
<option value="title">alphabetically</option>
in the number[1] selector... and so on for all other fields in the applicable mysql table.

To do allow ascending/descending selection add
<select name="order[1]">
<option value="asc">ascending</option>
<option value="desc">descending</option>
</select>




Description Make selectors to let users choose what to see.
Rating
Views 300 views. Averaging 0 views per day.
Similar Listings