• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 A category-image

bart

Active member
#1
I would like to add a category image in all resource-cetagories. There's one place where I can't get it working: in the title.

I would really like to change this:
Code:
<xen:title>{$category.category_title}</xen:title>
into this:
Code:
<xen:title><img src="path_to_image/{$_category.resource_category_id}.png">{$category.category_title}</xen:title>
It shows the image, but the title of the page is changed as well.

I've been trying to get it done with a span-element, but that didn't work out either, because it leave a 50-pixel-high chunk of white under the title.

Code:
<xen:title>{$category.category_title}</xen:title><span style="float:left;position:relative;top:-56px;left:6px;"><img src="path_to_image/{$category.resource_category_id}.png" width=48 height=48></span>
Pfffeeeww. Something so futile is taking me a whole morning...
Does anyone have a tip?
 
Last edited:

bart

Active member
#3
That was the tip I was waiting for.

I finally got it to work:

Code:
<xen:description class="baseHtml"><span style="float:left;margin-left:-56px;margin-bottom:-50px;top:-32px;position:relative;"><img src="path/to/{$category.resource_category_id}.png" width=48 height=48></span>{xen:raw $category.category_description}</xen:description>
With this in the extra-template:

Code:
.resource_category .titleBar
{
  margin-left:60px;
}
Thanks!