Category Icons in sidebar
Category Icons in sidebar
Could anyone please help me put the category icon into the sidebar?
I managed to place the category icon in the top right corner of the entry title, but i cannot put that same code into the plugin_categories.tpl to make it work.
I know we used to be able to do it about 10 years ago or so, but I cannot remember or find my notes on it.
Current version
Theme = i3Theme
I managed to place the category icon in the top right corner of the entry title, but i cannot put that same code into the plugin_categories.tpl to make it work.
I know we used to be able to do it about 10 years ago or so, but I cannot remember or find my notes on it.
Current version
Theme = i3Theme
- Attachments
-
- categories_entries.png (12.56 KiB) Viewed 6181 times
-
- categories.png (10.34 KiB) Viewed 6181 times
Re: Category Icons in sidebar
That's the category display as painted by the sidebar plugin, right?
In that case, did you already activate smarty templating in the options of the plugin? Then you should be able to add code to the used `plugin_categories.tpl`.
Or is that the step where you are already, and the code just does not work?
In that case, did you already activate smarty templating in the options of the plugin? Then you should be able to add code to the used `plugin_categories.tpl`.
Or is that the step where you are already, and the code just does not work?
Re: Category Icons in sidebar
Yes, the smarty stuff is allready enabled.
I copied the icon code from entries or somewhere, and placed it somewhere in the plugin_categories.tpl, probably the wrong location and the wrong icon if statement with span
is that right? Or could you show me which code i can copy for the icon in the category list.
I copied the icon code from entries or somewhere, and placed it somewhere in the plugin_categories.tpl, probably the wrong location and the wrong icon if statement with span
is that right? Or could you show me which code i can copy for the icon in the category list.
Re: Category Icons in sidebar
I'm honestly not sure how I'd solve this, haven't done so in my blog. Could you share the code you used so far? I can at least compare with the logic in the plugin .tpl, maybe that helps.
Re: Category Icons in sidebar
Get the icon next to the entry title
This is in the entries.tpl in the default template.
Then i was thinking to take the icon if statement from above and place it somewhere over here
This is in the entries.tpl in the default template.
Code: Select all
<h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>
<div class="serendipity_entry serendipity_entry_author_{$entry.author|@makeFilename} {if $entry.is_entry_owner}serendipity_entry_author_self{/if}">
{if $entry.categories}
<span class="serendipity_entryIcon">
{foreach from=$entry.categories item="entry_category"}
{if $entry_category.category_icon}
<a href="{$entry_category.category_link}"><img class="serendipity_entryIcon" title="{$entry_category.category_name|@escape}{$entry_category.category_description|@emptyPrefix}" alt="{$entry_category.category_name|@escape}" src="{$entry_category.category_icon|escape}" /></a>
{/if}
{/foreach}
</span>
{/if}
<div class="serendipity_entry_body">
{$entry.body}
</div>
Then i was thinking to take the icon if statement from above and place it somewhere over here
Code: Select all
<ul id="serendipity_categories_list" style="list-style: none; margin: 0px; padding: 0px">
{foreach from=$categories item="plugin_category"}
<li class="category_depth{$plugin_category.catdepth} category_{$plugin_category.categoryid}" style="display: block;">
{if $is_form}
<input style="width: 15px" type="checkbox" name="serendipity[multiCat][]" value="{$plugin_category.categoryid}" />
{/if}
{if !empty($category_image)}
<a class="serendipity_xml_icon" href="{$plugin_category.feedCategoryURL}"><img src="{$category_image}" alt="XML" style="border: 0px" /></a>
{/if}
------like right here after the XML icon but before the category title
<a href="{$plugin_category.categoryURL}" title="{$plugin_category.category_description|escape}" style="padding-left: {$plugin_category.paddingPx}px">{$plugin_category.category_name|escape}</a>
</li>
{/foreach}
</ul>
Re: Category Icons in sidebar
Did you rename the variable? Like from this:
to, since the plugin_sidebar.tpl has no $entry_category:
You should also debug how $plugin_category is filled, by adding {$plugin_category|@print_r} to your tpl. But based on the code, the .category_icon should be available.
Code: Select all
{if $entry_category.category_icon}
<a href="{$entry_category.category_link}"><img class="serendipity_entryIcon" title="{$entry_category.category_name|@escape}{$entry_category.category_description|@emptyPrefix}" alt="{$entry_category.category_name|@escape}" src="{$entry_category.category_icon|escape}" /></a>
{/if}
Code: Select all
{if $plugin_category.category_icon}
<a href="{$plugin_category.category_link}"><img class="serendipity_entryIcon" title="{$plugin_category.category_name|@escape}{$plugin_category.category_description|@emptyPrefix}" alt="{$plugin_category.category_name|@escape}" src="{$plugin_category.category_icon|escape}" /></a>
{/if}
Re: Category Icons in sidebar
nope still cannot get it to work.
tried various combinations of this "plugin_category.category_icon"
even tried to read through the lang/en files
also tried the {$plugin_category|@print_r}, but it produced nothing that i could see
i am stuck
tried various combinations of this "plugin_category.category_icon"
even tried to read through the lang/en files
also tried the {$plugin_category|@print_r}, but it produced nothing that i could see
i am stuck
Re: Category Icons in sidebar
One more question before I debug this in my dev blog: Which file exactly are you editing there?
Re: Category Icons in sidebar
the plugin_categories.tpl in the default template
Re: Category Icons in sidebar
I know that's misleading, but that one isn't used anymore. It's the old default, only used when themes specifically are configured to use it, which yours should not be.
Copy it into your theme directory, or better yet: Copy it from templates/2k11/.
Copy it into your theme directory, or better yet: Copy it from templates/2k11/.
Re: Category Icons in sidebar
Like you mean copy the plugin_categories.tpl from templates/2k11/ into the i3theme folder?
Yay! that works 100% thank you
just now need to figure out how to move the icons to infront of the title
Yay! that works 100% thank you
just now need to figure out how to move the icons to infront of the title
- Attachments
-
- move icons.png (14.03 KiB) Viewed 6050 times
Re: Category Icons in sidebar
Fantastic, i got it moved.
Needed to add this left in the class
<img class="serendipity_entryIcon_left
Needed to add this left in the class
<img class="serendipity_entryIcon_left
Re: Category Icons in sidebar
Hey, great :)