return $data;
}
-<!--~opt_listing {~-->
-# You may pass a "where clause" for the db query.
-function ~file_name~_display_listing($where = 'order by ~always_field~ limit 100') {
- $rows = db_get_assocs('~table_name~', 'id<!--~listing_fields_1 {~-->,~name~<!--~}~-->', $where);
- if($rows == false || count($rows) == 0) {
- tem_set('listings', array('empty_listing' => true));
- return;
- }
- # make sure there's something clickable
- foreach($rows as &$row) {
- if($row['~always_field~'] == '') {
- $row['~always_field~'] = '--';
- }
- }
- tem_set('listings', array(
- 'populated_listing' => true,
- 'rows' => $rows));
- return true;
-}
-<!--~}~-->
function ~file_name~_main() {<!--~opt_pass {~-->
if(!logged_in_as_admin()) {
$_REQUEST['url'] = this_url();
if(!$edit_id) {<!--~opt_listing {~-->
if(!isset($_REQUEST['~file_name~_new']) && !isset($_REQUEST['~always_field~'])) {
- ~file_name~_display_listing();
+ $listing_rows = db_get_assocs('~table_name~', 'id<!--~listing_fields_1 {~-->,~name~<!--~}~-->', 'order by ~always_field~ limit 100');
+ tem_set('listings', $listing_rows);
return;
}
<!--~}~-->