Jump to content

Image for each category in Knowledgebase?


Recommended Posts

Donna,

 

I was wondering if it was possible to assign an individual image to each category in the knowledgebase? Rather than use the same one for each? I've searched but cannot seem to find anything relating to this.

not from the settings, but you could do it with a very minor tweak to the knowledgebase.tpl template - e.g if you wanted to keep using Glyphicons (or FA), you could change...

 

<span class="glyphicon glyphicon-folder-close"></span> {$kbcat.name} <span class="badge badge-info">{$kbcat.numarticles}</span>

to...

<span class="glyphicon glyphicon-{if $kbcat.name eq 'Domains'}globe{elseif $kbcat.name eq 'Hosting'}hdd{else}folder-close{/if}"></span> {$kbcat.name} <span class="badge badge-info">{$kbcat.numarticles}</span>

 

EOVy4eS.png

 

although the downside to that method is you'd have to edit the template each time you added a category you want to use a different icon for... :roll:

 

alternatively, you could upload icon images (e.g create a kbicons folder in your assets/img/ directory) with the same filenames as your kb categories and use them instead...

 

{assign kbicon value="../{$BASE_PATH_IMG}/kbicons/{$kbcat.name|strtolower}.png"}
                   {if file_exists($kbicon)}<img src="{$kbicon}">{else}<span class="glyphicon glyphicon-folder-close"></span>{/if} {$kbcat.name} <span class="badge badge-info">{$kbcat.numarticles}</span>

this code will check to see if the appropriate image filename exists (e.g it matches the kb category name in lowercase) - if it does, it displays the icon; if it doesn't, it default to using the Glyphicon folder icon. :idea:

 

Lgd4D2i.png

Link to comment
Share on other sites

btw - in the {assign} tag in the above code, you don't need to use 'value=' - it's entirely option with later versions of Smarty... but I can't edit the post now without getting an error message! :mad:

 

{assign kbicon "../{$BASE_PATH_IMG}/kbicons/{$kbcat.name|strtolower}.png"}
{if file_exists($kbicon)}<img src="{$kbicon}">{else}<span class="glyphicon glyphicon-folder-close"></span>{/if} {$kbcat.name} <span class="badge badge-info">{$kbcat.numarticles}</span>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated