• [MOD COMPLETE] Show newest images in main cat from sub cat. + paging! 3 0 5 1
Currently:  

Author Topic: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!  (Read 69840 times)

0 Members and 1 Guest are viewing this topic.

Offline Mirwais

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #15 on: April 21, 2006, 07:39:45 PM »
Is it possible to let the main catogery to have only 9 latest images instead of haviing all images of sub cat

Hope you guys understand and have a Solution

thansk in advance 

Offline Mirwais

  • Newbie
  • *
  • Posts: 39
    • View Profile
Please!!11
reply

Offline SNKMAN

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #17 on: July 04, 2006, 12:15:00 AM »
Well i've got a little problem with this Mod:

Everything works so far... I can activate the mod at the ACP but i found out, when i insert this code

Code: [Select]
//-----------------------------------------------------
//--- Show Sub Images ---------------------------------
//-----------------------------------------------------

if ($master_cat['cat_master'] == 1){



$sql = "SELECT cat_parent_id
        FROM ".CATEGORIES_TABLE."
      WHERE cat_parent_id = $cat_id";
$total_subs = $site_db->query($sql);
$num_subs = $site_db->get_numrows($total_subs);



$sql = "SELECT i.image_id, i.cat_id, i.image_active, c.cat_parent_id
        FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
        WHERE i.image_active = 1 AND c.cat_parent_id = $cat_id AND c.cat_id = i.cat_id";

$result2 = $site_db->query($sql);
$num_rows2 = $site_db->get_numrows($result2);


$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);

//include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $perpage, $num_rows2, $link_arg);
$offset = $getpaging->get_offset();


$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_parent_id, c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_parent_id = $cat_id AND c.cat_id = i.cat_id
        ORDER BY ".$config['image_order']." ".$config['image_sort']."
        LIMIT $offset, $perpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);


$imgtable_width = ceil((intval($config['image_table_width'])) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

if (!$num_rows)  {
  $thumbnails = "";
  $msg = $lang['no_images'];
}
else {
  $thumbnails = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $thumbnails .= "<td width=\"".$imgtable_width."\"  =\"top\">\n";

    show_image($image_row);
    $thumbnails .= $site_template->parse_template("thumbnail_bit");
    $thumbnails .= "\n</td>\n";

    $count++;
    if ($count == $config['image_cells']) {
      $thumbnails .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover > 0) {
      for ($i = 0; $i < $leftover; $i++){
        $thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $thumbnails .= "</tr>\n";
    }
  }
  $thumbnails .= "</table>\n";
} //end else
$site_template->register_vars("thumbnails", $thumbnails);
unset($thumbnails);
}

All my categories are empty....  :cry:

Well i use 4images v. 1.7.2


Someone can help me out??

Offline F2F

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #18 on: October 09, 2006, 07:46:38 PM »
There is a problem with 1.7.3 version (the one I'm using), where it says:

2.3) find

Code: [Select]
  show_input_row($lang['field_hits'], "cat_hits", $result['cat_hits'], 5);

add after

Code: [Select]
  show_radio_row("cat_master", "cat_master", $result['cat_master']);

It should be:

Quote
2.3) find

Code: [Select]
  show_input_row($lang['field_hits'], "cat_hits", $result['cat_hits'], 5);

add after

Code: [Select]
  show_radio_row($lang['cat_master'], "cat_master", $cat_row['cat_master']);

At least, that's the only way it works for me using $cat_row['cat_master'] instead of $result['cat_master']. Sorry if I'm wrong...

Please, note that I'm also using the lang atribute (or whatever it is called), so you should add it to your language file in case you want to use it too. If not, just remove the lang atribute from the code I posted. Again, sorry if I missed something.

Regards.
« Last Edit: October 09, 2006, 09:17:01 PM by F2F »

Offline F4F

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #19 on: October 30, 2006, 07:48:14 PM »
Bei mir funktioniert es Perfekt!!!
Allerdings hätte ich noch ein Anliegen:

Wie kann ich auf der Home-Seite auch alle Bilder aller Kategorien anzeigen???


In my case it works perfekt!!!
But I have one extra question:

How can I show all pictures of all categories also on the home site of the gallery???


Nice greetings
F4F

Offline knsin0

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #20 on: June 10, 2007, 11:13:30 PM »
I have a problem installing this mod in 1.7.4, when I enable cat_master appear this at the header:

Code: [Select]
DB Error: Bad SQL Query: 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, c.cat_parent_id, c.cat_name, u.user_name FROM fondosimages i, fondoscategories c LEFT JOIN fondosusers u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_parent_id = 1 AND c.cat_id = i.cat_id ORDER BY image_name ASC LIMIT 0, 9
Unknown column 'i.user_id' in 'on clause'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\includes\db_mysql.php on line 116

 :|
What im doing wrong?

« Last Edit: June 11, 2007, 10:54:29 PM by knsin0 »

Offline cristina

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #21 on: June 19, 2007, 01:07:11 AM »
I have a problem installing this mod in 1.7.4, when I enable cat_master appear this at the header:

Code: [Select]
DB Error: Bad SQL Query: 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, c.cat_parent_id, c.cat_name, u.user_name FROM fondosimages i, fondoscategories c LEFT JOIN fondosusers u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_parent_id = 1 AND c.cat_id = i.cat_id ORDER BY image_name ASC LIMIT 0, 9
Unknown column 'i.user_id' in 'on clause'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\includes\db_mysql.php on line 116

 :|
What im doing wrong?

Had the same problem, but solved it just replacing:

Code: [Select]
        FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
With this:

Code: [Select]
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
Hope this helps!

Regards.

Offline knsin0

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #22 on: June 28, 2007, 09:28:53 PM »
I have a problem installing this mod in 1.7.4, when I enable cat_master appear this at the header:

Code: [Select]
DB Error: Bad SQL Query: 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, c.cat_parent_id, c.cat_name, u.user_name FROM fondosimages i, fondoscategories c LEFT JOIN fondosusers u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_parent_id = 1 AND c.cat_id = i.cat_id ORDER BY image_name ASC LIMIT 0, 9
Unknown column 'i.user_id' in 'on clause'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\includes\db_mysql.php on line 116

 :|
What im doing wrong?

Had the same problem, but solved it just replacing:

Code: [Select]
        FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
With this:

Code: [Select]
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
Hope this helps!

Regards.

great! now it works perfectly! thanks a lot! i have been a long time trying to fix that  :D

Offline knsin0

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #23 on: July 15, 2007, 04:01:20 AM »
Now the mod is only showing the newest pics, i cant see the paging  :?: I see some replies that seems to speak about that, but dont understand german...

edited: problem solved with this http://www.4homepages.de/forum/index.php?topic=10163.msg54840#msg54840 thanks again  :D
« Last Edit: July 15, 2007, 06:50:14 PM by knsin0 »

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #24 on: November 04, 2008, 04:40:45 PM »
Unfortunately does not work with 4images 1.7.6... Or I am not right?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #25 on: November 04, 2008, 04:44:47 PM »
Any reasons you think it doesn't work? ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #26 on: November 04, 2008, 05:25:12 PM »
Because I tried to put it...

1) Many PhP-commands are changed (for example
Code: [Select]
cat_name "=> htmlspecialchars ($cat_cache [$cat_id] [' cat_name '])). I have corrected them...

2) As a result all the same works nothing. A photo does not show, though numbers of pages are:D

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #27 on: November 04, 2008, 10:47:53 PM »
Ok ,in your version it's:
Code: [Select]
  "cat_name" => format_text($cat_cache[$cat_id]['cat_name'], 2),
change it to:
Code: [Select]
  "cat_name2" => format_text($cat_cache[$cat_id]['cat_name'], 2),

Anything else? (sorry, I don't have time to check it myself)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #28 on: November 05, 2008, 02:25:41 PM »
Yes, I know it. And already corrected by analogy all. But does not work as a result...

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
Re: [MOD COMPLETE] Show newest images in main cat from sub cat. + paging!
« Reply #29 on: December 17, 2008, 04:40:48 PM »
I'm sorry!  :oops: This mod realy work!!!!  :roll:

BUT Some questions:

1) If I has subsubcategories, photos therefrom are not shown. Probably to correct it?
2) Can mod show photos from cat_master too? On a level with subcategories?
3) If I change a category on cat_master, and I come once again into options, is shown that cat_master it is not necessary. Each time to come in phpMyAdmin it is inconvenient
4) Whether it is possible to do cat_master at once at category creation?

If somebody answers at least one question, I will be grateful!  :wink: Thanks