Author Topic: Confilct of the related images on the details page  (Read 4544 times)

0 Members and 1 Guest are viewing this topic.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Confilct of the related images on the details page
« on: February 04, 2008, 10:33:48 PM »
Hi,

I did a lot of work to have a related images on the details page, but there is a small conflict in this page.

I explain:

On my galery I have 2 gategories:
1- videos of the soccer players
2- Foto's of the soccer players

For example:
I have 4 videos of RONALDINHO en one (1) foto for this player

On the details.html of the foto of RONALDINHO I want to show also all his video's under (Thumbs ofcourse).

I added a new database field: image_player
That means the name of the player.

I used this code on the details.php:

Code: [Select]
//-----------------------------------------------------
//----------------------------------------BEGIN SHOW RELATED PLAYER IMAGES----------------------------------------------
//-----------------------------------------------------

 $image_speler = format_text($image_row['image_speler'], 2);

 $image_name = format_text($image_row['image_name'], 2);
 //i.image_speler = '$image_name'

$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").get_user_table_field(", u.", "user_email")."
        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_player = '$image_name'
        GROUP BY i.image_id
        ORDER BY i.image_name ASC";     
       
 
       
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);


if (!$num_rows)  {
  $related_speler_images = "<table class=\"head3\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $related_speler_images .= $lang['no_videos'];
  $related_speler_images .= "</td></tr></table>";
}
else  {
  $related_speler_images = "<table class=\"video_bekeken\" 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++ % 2 == 0) ? 1 : 2;
      $related_speler_images .= "<tr class=\"video_bekeken\">\n";
    }
    $related_speler_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

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

}

$site_template->register_vars("related_speler_images", $related_speler_images);
unset($related_speler_images);
//-----------------------------------------------------
//----------------------------------------END SHOW RELATED PLAYER IMAGES----------------------------------------------
//-----------------------------------------------------


More explaination:

Code: [Select]
WHERE i.image_player = '$image_name'
That means that the code see first the name of the image (foto): RONALIDNHO and then it wil get all the related images who has: i.image_player = RONALDINHO.


This code works almost perfect, but there is a problem:

1- If I use this code in the begining of the details.php, you get to see: The wright image + the wrong related videos.

2- If I use this code in the end of the details.php, you get to see: The wrong image + the WRIGHT related videos (Thumbs)


Thank you in advance,
Cruxy
« Last Edit: March 10, 2008, 07:50:46 PM by cruxy »

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Confilct of the related images on the details page
« Reply #1 on: February 19, 2008, 01:18:29 PM »
Any help or support please?
I really need it!

Offline ahmed_badawy

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: Confilct of the related images on the details page
« Reply #2 on: August 02, 2009, 02:35:00 AM »
i need it too  :roll:

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: Confilct of the related images on the details page
« Reply #3 on: August 02, 2009, 09:33:57 PM »
guys,

maybe is this what you are looking for [MOD]More Pictures on Detail Page
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi