Exemple #1
0
function session_dump($message)
{
    $ses = db_get_rows('wfpl_sessions', 'id,session_key,length,expires');
    if ($ses) {
        foreach ($ses as $row) {
            list($id, $session_key, $length, $expires) = $row;
            tem_set('id', $id);
            tem_set('session_key', $session_key);
            tem_set('length', $length);
            tem_set('expires', $expires);
            tem_sub('wfpl_sessions_row');
        }
    }
    $data = db_get_rows('wfpl_session_data', 'id,session_id,name,value');
    if ($data) {
        foreach ($data as $row) {
            list($id, $session_id, $name, $value) = $row;
            tem_set('id', $id);
            tem_set('session_id', $session_id);
            tem_set('name', $name);
            tem_set('value', $value);
            tem_sub('wfpl_session_data_row');
        }
    }
    tem_set('message', $message);
    tem_sub('block');
}
Exemple #2
0
    # call tem_sub()
    tem_sub('login');
    # This runs the template and prints the output. Running the template is
    # simply replacing all ~key~ tags with the associated value. The values are
    # set with tem_set() and tem_sub().
    tem_output();
    exit(0);
}
# Below is an example of using a sub-sub-template many times
# first set some values to be displayed in the row:
tem_set('foo', '*&^@$<>"');
tem_set('bar', 'one*&^@$<>"');
# Now run the row. This runs the sub-template for the row, and appends the data
# for the 'foobar_row' entry in the main key/value list.
tem_sub('foobar_row');
# and a couple more times:
tem_set('foo', '"""""****"""""');
tem_set('bar', 'two*&^"');
tem_sub('foobar_row');
tem_set('foo', '<<<<<<&&&&&&&&amp;>>>>>');
tem_set('bar', 'threeeeeeee*&^@$<>"eeeeeeeeeeee');
tem_sub('foobar_row');
# Now we have a 'foobar_row' in the main keyval array with three rows of html in it.
# in the template foobar_row is within a bigger sub-template called
# 'foobar_table'. The only reason for this is so that we can have that table
# not display at all when we're displaying the login. This is a silly use of
# the templates, but I wanted to demonstrate and test a simple use of a
# sub-template within a sub-template.
tem_sub('foobar_table');
# Now run the main template (the body of the template file)
tem_output();