noesac Posted July 6, 2010 Share Posted July 6, 2010 I came across an interesting issue.I should be able to fix this with a tiny IF statement but can't figure out where to start...I noticed that a thumbnail image is displayed at the top of the categories page for each of it's subcategories. This is fine but when you navigate into the subcategory itself, the same image is used - also shown at the top of the screen. Problem is ideally what you want to show at this point is a "widescreen" or "banner" version of that image, not a square one. So what I would like to implement is the following code in categories.tpl (at around line 15, just before the {if $category->id_image} line of code):IF CATEGORY HAS A PARENT CATEGORY THEN DO NOT SHOW CODE BELOWCan anyone assist? Link to comment Share on other sites More sharing options...
rocky Posted July 7, 2010 Share Posted July 7, 2010 There is no need to modify code to specify a thumbnail category image and full-size category image. Just use the image mapping feature. See my post here. Link to comment Share on other sites More sharing options...
noesac Posted July 7, 2010 Author Share Posted July 7, 2010 Thanks Rocky! That gets me half way there:)What I need is: ---Parent Category 1: wide photo (THE MAPPING FEATURE HELPS ME WITH THIS)---Parent Category 2: sub-category thumbnails (this is working as expected)------Sub-Category 1: hide the photo altogether (not sure how to do this one...?)I think the mapping solution only fixes the first problem? Link to comment Share on other sites More sharing options...
rocky Posted July 7, 2010 Share Posted July 7, 2010 So you want to hide the category image on categories that don't have any subcategories? I think you can do that by changing lines 17-25 of category.tpl in your theme's directory from: {if $scenes} <!-- Scenes --> {include file=$tpl_dir./scenes.tpl scenes=$scenes} {else} <!-- Category image --> {if $category->id_image} <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> {/if} {/if} to: {if $scenes} <!-- Scenes --> {include file=$tpl_dir./scenes.tpl scenes=$scenes} {elseif isset($subcategories)} <!-- Category image --> {if $category->id_image} <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> {/if} {/if} Link to comment Share on other sites More sharing options...
noesac Posted July 7, 2010 Author Share Posted July 7, 2010 Hi Rocky...almost:)I want to hide the category image for categories that have a parent category (and no specific alternative image mapped). Link to comment Share on other sites More sharing options...
rocky Posted July 7, 2010 Share Posted July 7, 2010 Here's a couple of other snippets of code you can try: {if $scenes} <!-- Scenes --> {include file=$tpl_dir./scenes.tpl scenes=$scenes} {elseif $category->id_parent == 1} <!-- Category image --> {if $category->id_image} <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> {/if} {/if} or: {if $scenes} <!-- Scenes --> {include file=$tpl_dir./scenes.tpl scenes=$scenes} {*{else} <!-- Category image --> {if $category->id_image} <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> {/if}*} {/if} Link to comment Share on other sites More sharing options...
noesac Posted July 7, 2010 Author Share Posted July 7, 2010 Thanks Rocky!!! That worked...both of them worked actually, so I guess I'll have to flip a coin...!I'll mark as solved. Link to comment Share on other sites More sharing options...
noesac Posted July 7, 2010 Author Share Posted July 7, 2010 Hi all, just an update. I've been doing some more testing around these two different bits of code. I think the first one is better. The second one only displays a "wide" category image that has been mapped. So in this regard the first one is less effort to maintain (for my situation anyway). I will continue testing this and leave my progress in this thread for people who need to use this in the future. Link to comment Share on other sites More sharing options...
Recommended Posts