Author Topic: Best/ Radnom images of the category  (Read 7639 times)

0 Members and 1 Guest are viewing this topic.

Offline Marcovich

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
    • High Definition Wallpapers
Best/ Radnom images of the category
« on: July 27, 2009, 11:38:15 PM »
Hey all, i would like to make 5 or 4 images in a row in every category and it will be "Best wallpapers of category cars" for examples or maybe Random will be better if that wont be to heavy on the database.

Would like to know if someone made this mod or something similar, thanks. :)

Rembrandt

  • Guest
[MOD]Best/ Random images of the category
« Reply #1 on: July 28, 2009, 07:17:30 AM »
Hi!
.. "Best wallpapers of category cars" ...
´

search in categorie.php:

unset($thumbnails);


add after:

//############################################# Cat Castom Select Pictures ################################################
//------------------------------------------------------------------------------------------------------------------
 
$order_by "i.image_hits"//  OR "i.image_date" "i.image_downloads" i.image_votes, i.image_rating, i.image_hits
//------------------------------------------------------------------------------------------------------------------ 
 
$num_new_images $config['image_cells'];
$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 i.cat_id = 
$cat_id AND c.cat_id = i.cat_id   
        ORDER BY 
$order_by DESC
        LIMIT 
$num_new_images ";

$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

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++ % == 0) ? 2;
      
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"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("cat_custom_pictures"$thumbnails);

unset(
$thumbnails);
//############################################# Cat Castom Select Pictures ################################################


search in categorie.html

{if categories}


add bevor:

{cat_custom_pictures}
<
hr size="1" />


mfg Andi
« Last Edit: January 27, 2014, 05:15:12 PM by Rembrandt »

Offline Marcovich

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
    • High Definition Wallpapers
Re: Best/ Radnom images of the category
« Reply #2 on: July 28, 2009, 12:36:01 PM »
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,i.image_group,i.image_group_image, c.cat_name, u.user_name FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id = 382 AND c.cat_id = i.cat_id AND NOT i.image_group <> i.image_group_image ORDER BY i.image_hits DESC LIMIT 4
Unknown column 'i.image_group' in 'field list'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/backgrou/public_html/includes/db_mysql.php on line 116

what to do? :)

Rembrandt

  • Guest
Re: Best/ Radnom images of the category
« Reply #3 on: July 28, 2009, 01:23:58 PM »
..
my error, edit my first post.

Sorry

mfg Andi

Offline wallward

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: Best/ Radnom images of the category
« Reply #4 on: January 24, 2014, 08:45:57 AM »
It's not working on 1.7.11 :(

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: Best/ Radnom images of the category
« Reply #5 on: January 27, 2014, 04:35:56 PM »
try to do that:

{cat_custom_pictures}
<
hr size="1" />
in your categorie.html

@andy: ein klitzekleiner fehler.. kannst du ihn korrigieren?

Rembrandt

  • Guest
Re: Best/ Radnom images of the category
« Reply #6 on: January 27, 2014, 05:16:08 PM »
...
@andy: ein klitzekleiner fehler.. kannst du ihn korrigieren?
lol, 10x hingesehen und nicht gefunden was du gemeint hast, Danke!

mfg Andi