4images Forum & Community
4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started 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
-
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
$site_template->register_vars(array(
"image_id" => $image_row['image_id'],
above this add
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
"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
<a href="{cat_url}">{cat_name}</a><br />
replace with
{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}
-
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 :)
-
I edited step 2, try now
-
Thanks that works wonders :P