4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: cch on January 05, 2009, 12:59:17 AM

Title: Categories
Post by: cch 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
Title: Re: Categories
Post by: alekinna on January 05, 2009, 02:21:38 AM
cch, try this

1. install this code (http://www.4homepages.de/forum/index.php?topic=23170.msg127699#msg127699)

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}
Title: Re: Categories
Post by: cch 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 :)
Title: Re: Categories
Post by: alekinna on January 05, 2009, 10:37:18 PM
I edited step 2, try now
Title: Re: Categories
Post by: cch on January 06, 2009, 12:04:27 AM
Thanks that works wonders :P