Dtorr1981 Posted September 28, 2016 Share Posted September 28, 2016 Hi All, 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. Thank you in advance. Donna 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 28, 2016 Share Posted September 28, 2016 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> 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... 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. 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 28, 2016 Share Posted September 28, 2016 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! {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> 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.