Author Topic: Show Parent Category with Category of Thumbnail?  (Read 3516 times)

0 Members and 1 Guest are viewing this topic.

Offline tSlater

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://www.senpai.net/~aslater/
Show Parent Category with Category of Thumbnail?
« on: December 19, 2002, 04:44:51 AM »
I have a lot of categories which are organised like this:

Ah! My Goddess
+Images
+Wallpapers
+Avatars
+Video
+Audio
Spirited Away
+Images
+Wallpapers
+Avatars
+Video

etc..

When an image appears in a search or is shown as the random image, it shows the thumbnail, Image name, category it is in, etc..  Well, it is kind of a pain to see that an image is from a category called "Images" when I have over 50 ategories by that same name. =P  So.. is there any way I can get a category's parent category too? =]

Thanks in advance

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Show Parent Category with Category of Thumbnail?
« Reply #1 on: December 19, 2002, 09:16:14 AM »
Try this:

Open includes/functions.php.

1. Search this part:
Code: [Select]
else {
  $user_name = $lang['userlevel_guest'];
  $user_name_link = $user_name;
}

and add this below:
Code: [Select]
$cat_parent_id = 0;
$cat_parent_name = "";
$cat_parent_url = "";
 
if ($cat_cache[$image_row['cat_id']]['cat_parent_id'] != 0) {
  $cat_parent_id = $cat_cache[$image_row['cat_id']]['cat_parent_id'];
  $cat_parent_name = $cat_cache[$cat_parent_id]['cat_name'];
  $cat_parent_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_parent_id);
}

2. Search this line:
Code: [Select]
"cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id']),
and add this below:
Code: [Select]
"cat_parent_name" => $cat_parent_name,
"cat_parent_url" => $cat_parent_url,


Then open the template thumbnail_bit.html and replace this
Code: [Select]
<a href="{cat_url}">{cat_name}</a>
with
Code: [Select]
{if cat_parent_name}<a href="{cat_parent_url}">{cat_parent_name}</a> / {endif cat_parent_name}<a href="{cat_url}">{cat_name}</a>
Do the same for random_image.html and random_cat_image.html.

Good luck,
Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search