Hi!
This Modification enable it set to different Number of Rows and Columns for different Categories.
New in the V.1.1 Images sort by "image name" "image_date" "image_downloads" "image_votes" "image_rating" "image_hits"
and Ascending or Descending.
1.) copy the contents of attachment "install_col_row_V.1.1.php" in your root and call it to.
have you the old version from the mod, ignore the error message when you run the installer.
2.) search in lang/yourlang/admin.php:
(english):
$lang['field_hits'] = "Hits";insert below:
$lang['field_row'] = "Rows";
$lang['field_col'] = "Columns";
(deutsch):
$lang['field_hits'] = "Anzahl Aufrufe";insert below:
$lang['field_row'] = "Zeilen";
$lang['field_col'] = "Spalten";
3.) search in root/global.php:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
and replace:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, cat_col, cat_row, cat_image_order, cat_image_sort, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
4.) search in root/categories.php
include(ROOT_PATH.'includes/paging.php');
insert above:
$config['image_cells'] = (!empty($cat_cache[$cat_id]['cat_col'])) ? $cat_cache[$cat_id]['cat_col']: $config['image_cells'];
$perpage = (!empty($cat_cache[$cat_id]['cat_col']) && (!empty($cat_cache[$cat_id]['cat_row']))) ? $cat_cache[$cat_id]['cat_col']*$cat_cache[$cat_id]['cat_row'] : $perpage;
4.1)search:
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
insert above:
$config['image_order'] = (!empty($cat_cache[$cat_id]['cat_image_order'])) ? $cat_cache[$cat_id]['cat_image_order']: $config['image_order'];
$config['image_sort'] = (!empty($cat_cache[$cat_id]['cat_image_sort'])) ? $cat_cache[$cat_id]['cat_image_sort']: $config['image_sort'];
5.) search in includes/page_header.php
$setperpage_dropdown = "\n<select onchange=\"if (this.options[this.selectedIndex].value != 0 && typeof forms['perpagebox'] != 'undefined'){ forms['perpagebox'].submit() }\" name=\"setperpage\" class=\"setperpageselect\">\n";
insert above:
if (empty($cat_cache[$cat_id]['cat_col']) || (empty($cat_cache[$cat_id]['cat_row']))){
5.1) search:
unset($setperpage_dropdown_form);
insert below:
}
6.) search in admin/categories.php:
if ($action == "ordercat") {
insert above:
function show_image_order_select($setting_name, $setting_value) {
global $image_order_optionlist,$setting;
echo "<tr class=\"".get_row_bg()."\">\n<td valign=\"top\"><p class=\"rowtitle\">".$setting[$setting_name]."</p></td>\n";
echo "<td><p>";
echo "<select name=\"".$setting_name."\">\n";
foreach ($image_order_optionlist as $key => $val) {
echo "<option value=\"$key\"";
if ($setting_value == $key) {
echo " selected=\"selected\"";
}
echo ">".$val."</option>\n";
}
echo "</select>\n";
echo "</p></td>\n</tr>\n";
}
function show_image_sort_select($setting_name, $setting_value) {
global $image_sort_optionlist,$setting;
echo "<tr class=\"".get_row_bg()."\">\n<td valign=\"top\"><p class=\"rowtitle\">".$setting[$setting_name]."</p></td>\n";
echo "<td><p>";
echo "<select name=\"".$setting_name."\">\n";
foreach ($image_sort_optionlist as $key => $val) {
echo "<option value=\"$key\"";
if ($setting_value == $key) {
echo " selected=\"selected\"";
}
echo ">".$val."</option>\n";
}
echo "</select>";
echo "</p></td>\n</tr>\n";
}
6.1) search:
$cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']);
$cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;
insert below:
$cat_col = intval($HTTP_POST_VARS['cat_col']);
$cat_row = intval($HTTP_POST_VARS['cat_row']);
$cat_image_order = (isset($HTTP_POST_VARS['image_order'])) ? $HTTP_POST_VARS['image_order'] : $HTTP_GET_VARS['image_order'];
$cat_image_sort =(isset($HTTP_POST_VARS['image_sort'])) ? $HTTP_POST_VARS['image_sort'] : $HTTP_GET_VARS['image_sort'];
6.2) search:
$sql = "INSERT INTO ".CATEGORIES_TABLE."
(cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
VALUES
('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";
replace:
$sql = "INSERT INTO ".CATEGORIES_TABLE."
(cat_name, cat_description, cat_parent_id, cat_order, cat_col, cat_row, cat_image_order, cat_image_sort, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
VALUES
('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $cat_col, $cat_row, '$image_order', '$image_sort', $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";
6.3) search:
$permission_headline = $lang['permissions'];
insert above:
show_input_row($lang['field_col'], "cat_col", $cat_row['cat_col'], 5);
show_input_row($lang['field_row'], "cat_row", $cat_row['cat_row'], 5);
$cat_image_order = (isset($HTTP_POST_VARS['image_order'])) ? $HTTP_POST_VARS['image_order'] : $config['image_order'];
$cat_image_sort = (isset($HTTP_POST_VARS['image_sort'])) ? $HTTP_POST_VARS['image_sort'] : $config['image_sort'];
show_image_order_select("image_order", $cat_image_order);
show_image_sort_select("image_sort", $cat_image_sort);
6.4) search:
$cat_hits = intval(trim($HTTP_POST_VARS['cat_hits']));
$cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;
insert below:
$cat_col = intval($HTTP_POST_VARS['cat_col']);
$cat_row = intval($HTTP_POST_VARS['cat_row']);
$cat_image_order = (isset($HTTP_POST_VARS['image_order'])) ? $HTTP_POST_VARS['image_order'] : $config['image_order'];
$cat_image_sort = (isset($HTTP_POST_VARS['image_sort'])) ? $HTTP_POST_VARS['image_sort'] : $config['image_sort'];
6.5) search:
$sql = "UPDATE ".CATEGORIES_TABLE."
SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
WHERE cat_id = $cat_id";
replace:
$sql = "UPDATE ".CATEGORIES_TABLE."
SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_col = $cat_col, cat_row = $cat_row, cat_image_order = '$cat_image_order', cat_image_sort = '$cat_image_sort', cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
WHERE cat_id = $cat_id";
6.6) search:
$sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
FROM ".CATEGORIES_TABLE."
WHERE cat_id = $cat_id";
replace:
$sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, cat_col, cat_row, cat_image_order, cat_image_sort, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
FROM ".CATEGORIES_TABLE."
WHERE cat_id = $cat_id";
6.7) search:
show_table_separator($lang['permissions'], 2);
insert above:
show_input_row($lang['field_col'], "cat_col", $cat_row['cat_col'], 5);
show_input_row($lang['field_row'], "cat_row", $cat_row['cat_row'], 5);
show_image_order_select("image_order", $cat_row['cat_image_order']);
show_image_sort_select("image_sort", $cat_row['cat_image_sort']);
6.8 ) search:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
FROM ".CATEGORIES_TABLE."
WHERE cat_parent_id = 0
ORDER BY cat_order, cat_name ASC";
replace:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, cat_col, cat_row, cat_image_order, cat_image_sort, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
FROM ".CATEGORIES_TABLE."
WHERE cat_parent_id = 0
ORDER BY cat_order, cat_name ASC";
6.9) search:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
FROM ".CATEGORIES_TABLE."
$where_sql
ORDER BY cat_order, cat_name ASC";
replace:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, cat_col, cat_row, cat_image_order, cat_image_sort, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
FROM ".CATEGORIES_TABLE."
$where_sql
ORDER BY cat_order, cat_name ASC";
now you can go to edit category, and enter the column and row
and Images sort by "image name" "image_date" "image_downloads" "image_votes" "image_rating" "image_hits"
and Ascending or Descending.
mfg Andi