4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: khansahib on December 19, 2010, 03:59:27 PM

Title: [Mod] Different Number of Rows and Columns for different Categories
Post by: khansahib on December 19, 2010, 03:59:27 PM
How can i've different/independent number of rows and columns for different categories in a gallery??

Thanks :)
Title: [Mod] Different Number of Rows and Columns for different Categories
Post by: Rembrandt on December 19, 2010, 07:58:04 PM
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
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: khansahib on December 19, 2010, 08:32:53 PM
Amazing you're savior....
it worked like a charm..
Thanks Alot :)
just a thought can you add sorting for each category :)
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: Rembrandt on December 21, 2010, 08:43:44 AM
i have my first post updatet..

mfg Andi
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: khansahib on December 21, 2010, 09:32:23 AM
Amazing!!! Thanks Alot Brother :)
You made my Day!.  8)
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: Wuff on April 06, 2011, 09:02:00 PM
ich steh auf dem Schlauch.....
ich möchte, dass die Hauptkategorien  untereinander zeigt werden, (nur im linken frame!)
aber die Unterordner ( im rechten frame) sollen immer 4 nebeneinander sein

ich hab jetzt einige Varianten versucht - ich komm einfach nicht drauf wo genau ich
das einstellen muss.....
logisch für mich wäre:
in den Einstellungen
Wieviele Zellen soll die Tabelle der Kategorien haben    4
und dann bei Kategorien bearbeiten bei den Hauptordnern     Spalten 0

leider klappt es einfach nicht wie ich das gerne hätte.....
kann mir da bitte jemand weiter helfen?

kann es evtl. sein, dass es ein Problem mit einem anderen MOD gibt?
http://www.4homepages.de/forum/index.php?topic=23238.0
in der
includes/page_header.php
stehen beide MODS drin.....
trotzdem werden mir nun auf der index.php plötzlich wieder die Hauptkategorien auch rechts angezeigt  :cry:
und dieser MOD scheint nicht zu funktionieren - egal was ich bei Kategorie bearbeiten hinein schreibe - es ändert sich nichts....
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: Rembrandt on April 09, 2011, 05:08:45 AM
....und dieser MOD scheint nicht zu funktionieren - egal was ich bei Kategorie bearbeiten hinein schreibe - es ändert sich nichts....
ich denke du bist mit deinem Problem hier komplett falsch.
Du verwechselt hier etwas, dieser Mod ist dazu da um die Anzahl der Bilder (zeilen und spalten) in den einzelnen Kategorien unterschiedlich darzustellen.

mfg Andi
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: khansahib on May 05, 2011, 07:48:21 PM
this mod was working alright till now but all of a sudden in admin panel its not adding categories. i'm getting this "Error adding categories".
i haven't added any other mod nor i've updated 4images version.. can u please help and tell why this is happening..
Thanks. :)
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: Rembrandt on May 05, 2011, 08:17:48 PM
i have edit  step 6.2),  please repeat it.

mfg Andi
Title: Re: [Mod] Different Number of Rows and Columns for different Categories
Post by: khansahib on May 05, 2011, 09:04:55 PM
its back on track again :D
Thanks alot :)