• [MOD] Pictures of a specified category / Bilder einer bestimmten Kategorie anzei 5 0 5 1
Currently:  

Author Topic: [MOD] Pictures of a specified category / Bilder einer bestimmten Kategorie anzei  (Read 21289 times)

0 Members and 1 Guest are viewing this topic.

Offline Sumale.my

  • Addicted member
  • ******
  • Posts: 1.790
  • I ♥ 4I
    • View Profile
Open / Öffne: index.php
Search / Suche:
$site_template->register_vars("new_images"$new_images);
unset(
$new_images);

Add after / Füge danach ein:
//-----------------------------------------------------
//--- Show New Images By Category ---------------------
//-----------------------------------------------------
$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;
  }
}

$num_news_images_bycat $config['image_cells'];
// Option Start
$bycat_in = array(72,132); // Change the Number in your category-id - ID ripping by commas
                           // Ändere die Nummer in deine Kategorie-ID - ID trennen durch Komma
// Option Ende
$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")."
        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_id = i.cat_id AND i.cat_id IN ("
.get_auth_cat_sql("auth_viewcat").") AND i.cat_id IN (".implode(", "$bycat_in).") 
        ORDER BY i.image_date DESC
        LIMIT 
$num_news_images_bycat";
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

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

    
show_image($image_row);
    
$news_images_bycat .= $site_template->parse_template("thumbnail_bit");
    
$news_images_bycat .= "\n</td>\n";
    
$count++;
    if (
$count == $config['image_cells']) {
      
$news_images_bycat .= "</tr>\n";
      
$count 0;
    }
  } 
// end while

  
if ($count 0)  {
    
$leftover = ($config['image_cells'] - $count);
    if (
$leftover >= 1) {
      for (
$f 0$f $leftover$f++) {
        
$news_images_bycat .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$news_images_bycat .= "</tr>\n";
    }
  }
  
$news_images_bycat .= "</table>\n";
// end else

$site_template->register_vars("news_images_bycat"$news_images_bycat);
unset(
$news_images_bycat);


Suche nach // Option Start. Dort müssen die ID´s der Kategorien eingetragen werden
Search / / Start option. Where the ID's of the categories listed


Add this code in your home.html
Füge diesen Code in deiner home.html ein
{news_images_bycat}

Finish
Fertig
« Last Edit: November 15, 2015, 03:17:23 PM by Sumale.my »
Beste Grüße
Sumale.my

Offline Sumale.my

  • Addicted member
  • ******
  • Posts: 1.790
  • I ♥ 4I
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #1 on: June 26, 2010, 09:58:10 AM »
Wie kann man das eiegntlich extern ausgeben lassen?
Beste Grüße
Sumale.my

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: [MOD] See new pictures of a specified category
« Reply #2 on: July 05, 2010, 03:28:29 AM »
great mod  :wink: cant we control this over the admin panel ;  its always pain to edit the code  :mrgreen: ! thanks !
I'm Back :)

Offline khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #3 on: August 29, 2010, 11:55:30 PM »
great and very useful mod, is there way to disply new images from all sub categories under a specified main category?

for example :
I have the main category "Main Category" and its sub ctegories "Sub Cat1>Sub Cat2>Sub Cat3>Sub Cat4>"   in the code (index.php) assign only the main category ID and the script disply new images from all its sub categories.

things are very much clear in your post i can get the result by adding all sub cats IDs but I frequently adding new sub categories under different Main Categories and its a bit difficult to add Cat IDs every time i add a new sub cat.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] See new pictures of a specified category
« Reply #4 on: August 30, 2010, 04:00:34 AM »
You can use something like this:
$main_cat_id 123//Main Category ID
$subcat_ids = array();
get_subcat_ids($main_cat_id$main_cat_id$cat_parent_cache);
$bycat_in $subcat_ids[$main_cat_id];
« Last Edit: September 01, 2010, 05:34:18 AM by V@no »
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 khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #5 on: August 30, 2010, 08:56:51 PM »
hi v@no!
i add the code after line
Code: [Select]
$bycat_in = array(my cat ID); but there is no output except a blank space. please let me know where i exactly place or replace the code.

Thanx

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] See new pictures of a specified category
« Reply #6 on: August 30, 2010, 09:09:29 PM »
blank space? if anything, it should tell you that there is no images...or you mean blank page?
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 khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #7 on: August 30, 2010, 09:21:27 PM »
i added th tag {news_images_bycat} on my home page, i have a main category ID = 2 and it has a sub cat ID = 8 when i assign sub cat ID directly to (   $bycat_in = array(my sub cat ID 8);  ) without adding your code it works and display the new images from that sub cat, but after adding the code i assign Main Cat ID which is in my case 2, there is nothing to display.

rest of the page is ok, every things are displying, my code is:
// Option Start

$bycat_in = array(2); // Change the Number in your category-id - ID ripping by commas

$main_cat_id 2//Main Category ID
$subcat_ids = array();
get_subcat_ids($main_cat_id$main_cat_id$cat_parent_cache);
$bycat_id $subcat_ids;
// Option Ende

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] See new pictures of a specified category
« Reply #8 on: August 31, 2010, 02:29:06 AM »
oopsy daisy  :oops:

Replace $bycat_id with $bycat_in
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 khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #9 on: August 31, 2010, 10:07:08 PM »

same as before but now i get error message "An unexpected error occured. Please try again later."
« Last Edit: August 31, 2010, 10:45:49 PM by khan »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] See new pictures of a specified category
« Reply #10 on: September 01, 2010, 05:35:08 AM »
hmmm apparently I forgot how that function works..
replace
$bycat_in $subcat_ids;

With:
$bycat_in $subcat_ids[$main_cat_id];
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 khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #11 on: September 01, 2010, 12:42:30 PM »
Wow .... thanx v@no it works now

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] See new pictures of a specified category
« Reply #12 on: December 29, 2010, 04:21:18 AM »
exactly what i needed. Thanks!

Offline nightfallsnet

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #13 on: January 04, 2011, 10:15:37 AM »
hmm edited index.php and added {news_images_bycat} to home not showin anything.. 1.7.9

Offline a1367h

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: [MOD] See new pictures of a specified category
« Reply #14 on: December 20, 2012, 03:03:53 AM »
Hi.
I want  to use it just for one category. when i set my category number, it just repeat one image in two rows and 4 columns same as new images number.(8 images)
I need 4 images in one row.
could anyone help me?

sorry for my bad English. I'm not expert in English.
I hope you understand what I  want.
Hossein Rad

 

Post your comments here