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.


<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">
        <th>User ID</th>
    <!-- BEGINBLOCK list -->
    <!-- ENDBLOCK -->


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?

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