Sample 1: Displaying User List

This chapter gives you a sample on displaying the user list using qE. You will see how easy it is to work with qE.

test.tpl

<h1>Welcome to test page!</h1>
<!-- BEGINIF $login -->
<p>You are logged in as: {$current_user_id}</p>
<!-- ELSE -->
<p>You are not logged in.</p>
<!-- ENDIF -->

<table class="table_2" border="0">
    <tr>
        <th>User ID</th>
        <th>Email</th>
        <th>Level</th>
        <th>Since</th>
        <th>Notes</th>
    </tr>
    <!-- BEGINBLOCK list -->
    <tr>
        <td>{$user_id}</td>
        <td>{$user_email}</td>
        <td>{$user_level}</td>
        <td>{$user_since}</td>
        <td>{$user_notes}</td>
    </tr>
    <!-- ENDBLOCK -->
</table>

test.php

<?php
require './includes/user_init.php';

// now load the output tpl
$tpl = load_tpl ('test.tpl');

// all block output must be contained in $var['block_list']
// or any block_name defined
$txt['block_list'] = '';

// get entries from db
$res = sql_query ("SELECT * FROM ".$db_prefix."user ORDER BY user_id");
while ($row = sql_fetch_array ($res))
{
    // convert the date from SQL format to human format
    $row['user_since'] = convert_date ($row['user_since']);
   
    // create the block
    $txt['block_list'] .= quick_tpl ($tpl_block['list'], $row);
}

// output
$txt['main_body'] = quick_tpl ($tpl, $txt);
flush_tpl ();
?>

The Result

Sample 1


There is one comment. Why not be the second?

Hey
Where this file to be located to make this work ?

There are 1 replies on this comment
Guest Apr-27-2015

More Comments/Post Your Own

Advertisement

Latest Comments

  • Guest on Forum
    “noFollow links.” - Jun 19
  • username on Forum
    “Sponsor or Premium user” - Jun 14
  • on Forum
    “Template https://www.website.com/skins/_common/section.tpl not found! contact webmaster” - Feb 24
  • admin on 01. Administration Panel
    “Untitled” - Jan 24
  • on 01. Administration Panel
    “Can't Login to Admin” - Jan 23

Most Commented

Online Users

There are 23 users online.

Connect

Connect with us on Facebook

Newsletter

Subscribe to our newsletter for the latest updates and exciting promotions!