$num_items = $db->query($db->sql())->fetchColumn(); $db->select('a.album_id, a.name, a.category_id, a.alias, a.capturelocal, a.description, a.num_photo, a.date_added, a.viewed, a.author, r.file, r.thumb')->order('a.date_added DESC')->limit($per_page)->where('a.status= 1 AND r.defaults = 1')->offset(($page - 1) * $per_page); $result = $db->query($db->sql()); while ($item = $result->fetch()) { $sql = 'SELECT userid, username, first_name, last_name, photo FROM ' . NV_USERS_GLOBALTABLE . ' WHERE active=1 AND userid= ' . $item['author']; $array_user = nv_db_cache($sql, 'userid', $module_name); if (!empty($array_user)) { foreach ($array_user as $array_user_i) { if (!empty($array_user_i['first_name']) && !empty($array_user_i['last_name'])) { $item['author_upload'] = $array_user_i['first_name'] . ' ' . $array_user_i['last_name']; } else { $item['author_upload'] = $array_user_i['username']; } if (!empty($array_user_i['photo'])) { $item['author_image'] = $array_user_i['photo']; } else { $item['author_image'] = 'themes/default/images/users/no_avatar.png'; } } } $item['link'] = $global_photo_cat[$item['category_id']]['link'] . '/' . $item['alias'] . '-' . $item['album_id']; $array_album[] = $item; } $result->closeCursor(); } $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page); $contents = home_view_grid_by_album($array_album, $generate_page); } include NV_ROOTDIR . '/includes/header.php'; echo nv_site_theme($contents); include NV_ROOTDIR . '/includes/footer.php';
while ($item = $result->fetch()) { $item['link'] = $global_photo_cat[$_category_id]['link'] . '/' . $item['alias'] . '-' . $item['album_id'] . $global_config['rewrite_exturl']; $array_cat[$key]['content'][] = $item; } $result->closeCursor(); ++$key; } } } $contents = home_view_grid_by_cat($array_cat); } elseif ($photo_config['home_view'] == 'home_view_grid_by_album') { $array_album = array(); if (!empty($global_photo_cat)) { $sql = 'SELECT a.album_id, a.name, a.category_id, a.alias, a.capturelocal, a.description, a.num_photo, a.date_added, r.file, r.thumb FROM ' . TABLE_PHOTO_NAME . '_album a LEFT JOIN ' . TABLE_PHOTO_NAME . '_rows r ON ( a.album_id = r.album_id ) WHERE a.status= 1 AND r.defaults = 1 ORDER BY a.date_added DESC LIMIT 0 , ' . $photo_config['per_page_album']; $result = $db->query($sql); while ($item = $result->fetch()) { $item['link'] = $global_photo_cat[$item['category_id']]['link'] . '/' . $item['alias'] . '-' . $item['album_id'] . $global_config['rewrite_exturl']; $array_album[] = $item; } $result->closeCursor(); } $contents = home_view_grid_by_album($array_album); } // $numalbum = $db->query( 'SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_album' )->fetchColumn(); include NV_ROOTDIR . '/includes/header.php'; echo nv_site_theme($contents); include NV_ROOTDIR . '/includes/footer.php';