Users ordered with Karma
You can use javascript in the templates to make your report even more dynamic. This example shows the users with karma. Users can earn karma by logging in to the site, contribute to the forum.
The SQL looks like:
SELECT
karma,userName
FROM
users
WHERE
status = 'Active'
The template contains the javascript:
<div class="content">
<a name="<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
<p><tmpl_var controls></p>
</tmpl_if>
<tmpl_if displayTitle>
<h1><tmpl_var title></h1>
</tmpl_if>
<tmpl_if description>
<tmpl_var description><p />
</tmpl_if>
<tmpl_if debugMode>
<ul>
<tmpl_loop debug_loop>
<li><tmpl_var debug.output></li>
</tmpl_loop>
</ul>
</tmpl_if>
<table align="center" width="80%">
<tmpl_loop rows_loop>
<tr>
<td valign="top">
<tmpl_var row.field.userName.value>
</td>
<td>
<div id="<tmpl_var row.field.userName.value>" style="background-color:#F00; width:0px;"><tmpl_var row.field.karma.value></div>
<script type="text/javascript">
e = document.getElementById('<tmpl_var row.field.userName.value>');
e.style.width='<tmpl_var row.field.karma.value>px';
</script>
</td>
</tr>
</tmpl_loop>
</table>
</div>
| Visitor |
0
|
| Admin |
7
|
| joeri |
51
|
| arjan |
1
|
| gredenz |
1
|
| torque |
1
|
| jgallego |
2
|
| estivenrpo |
2
|
| william |
1
|
| SHEETAL |
1
|
| cjalain |
1
|
| len |
9
|
| tineke |
1
|
| rory |
97
|
| demartin |
4
|
| ian |
1
|
| mcarring |
1
|
| bart |
1
|
| barsamj |
1
|
| hoan |
1
|
| vinayv |
2
|
| zoran035 |
1
|
| hamid9196 |
1
|
| freddie |
2
|
| fawas |
1
|
| m0rteza |
1
|
| barbr |
1
|
| fhm_t2002 |
1
|
| bogie |
1
|
| ben.liquete |
1
|
| maroend |
1
|