Author Topic: Categories  (Read 5377 times)

0 Members and 1 Guest are viewing this topic.

Offline cch

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
Categories
« on: January 05, 2009, 12:59:17 AM »
Hi all

Me again :lol: I have 20+ Categories with 20+ Sub Categories in each. I'm uploading all my images into the Sub Categories and on the main page the images showing in the New Images section have the Sub Category name below the thumbnail, is there a way to change it from the Sub Category name to the Category name :)

Hope this make sense :D

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: Categories
« Reply #1 on: January 05, 2009, 02:21:38 AM »
cch, try this

1. install this code

2. in file includes/functions.php

find block
Code: [Select]
$site_template->register_vars(array(
    "image_id" => $image_row['image_id'],

above this add
Code: [Select]
if ($cat_cache[$image_row['cat_id']]['cat_parent_id']) {
  $cat_parent_name = $cat_cache[$cat_cache[$image_row['cat_id']]['cat_parent_id']]['cat_name'];
}
else {
  $cat_parent_name = "";
}

and below the block add
Code: [Select]
"cat_parent_name" => $cat_parent_name,
    "cat_parent_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_cache[$image_row['cat_id']]['cat_parent_id']),

3. in the file thumbnail_bit.html

find
Code: [Select]
<a href="{cat_url}">{cat_name}</a><br />
replace with
Code: [Select]
{if index}{if cat_parent_name}<a href="{cat_parent_url}">{cat_parent_name}</a><br>{endif cat_parent_name}{ifno cat_parent_name}<a href="{cat_url}">{cat_name}</a><br />{endifno cat_parent_name}{endif index}{ifno index}<a href="{cat_url}">{cat_name}</a><br />{endifno index}
« Last Edit: January 05, 2009, 10:36:37 PM by alekinna »

Offline cch

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
Re: Categories
« Reply #2 on: January 05, 2009, 11:38:13 AM »
Hi, thanks for your help, but it's not fully working, the link is pointing to the Parent Category but the text is displaying the Sub Category :)
« Last Edit: January 05, 2009, 01:04:53 PM by cch »

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: Categories
« Reply #3 on: January 05, 2009, 10:37:18 PM »
I edited step 2, try now

Offline cch

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
Re: Categories
« Reply #4 on: January 06, 2009, 12:04:27 AM »
Thanks that works wonders :P