How to get images to display next to Categories

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
MadFly
Regular
Posts: 56
Joined: Fri Dec 26, 2008 7:47 pm
Location: Cape Town, South Africa

How to get images to display next to Categories

Post by MadFly »

I have added an image, but it does not display on the main page... should i refresh a template or something? how do i get the images to display next to the categories?
ameo
Regular
Posts: 143
Joined: Fri Sep 26, 2008 4:13 am

Post by ameo »

Hi,
i've never tried that myself but i think that the image you're talking about doens't actually show up in the category widget on the sidebar. it only show in it's related page as in domain.com/categories/8-Category

it'd be easy to make it as html nugget on the sidebar and use some html

HTH
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Not sure I understand you....

Have you added an image to a category? If so, those are typically used as an icon representing the category. What template are you using?
=Don=
MadFly
Regular
Posts: 56
Joined: Fri Dec 26, 2008 7:47 pm
Location: Cape Town, South Africa

Post by MadFly »

yes i have added an image to an category. there where you create a new category, if you edit that new one, it gives you the option "image". Then i uploaded a small pic via the media, into the gallery, then from the "IMAGE" option in the category edit page i select that image. but nothing is displayed in the categories sidebar, and thats where i actually want them.

i am using i3theme
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

The icon does not appear in the sidebar. If your template supports category icons, it will appear within any entry assigned to that category.

I use them myself - simply click on the link in my signature below to see how they work.
=Don=
ameo
Regular
Posts: 143
Joined: Fri Sep 26, 2008 4:13 am

Post by ameo »

really! i didn't know that s9y can do that with cats.

Image

where is yours?
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Those are XML icons, and the sidebar category plugin can enable those.

My category icons are in the top, right of every entry that uses them. For instance:

Image
=Don=
ameo
Regular
Posts: 143
Joined: Fri Sep 26, 2008 4:13 am

Post by ameo »

Wow,
http://www.optional-necessity.com/uploa ... plates.png

and.. what is the default dimensions here [[ 60px × 64px ?? ]] like yours?

or s9y will automatically resize it?

will it be always listed on top right corner of each post? can i change that to bottom left?


Thanks
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

There is no default to the category image/icon. I created my own using images from the same icon pack s9y used on the backend combined with a bit of my own tinkering in photoshop.

Placement is dependent on a) your template's entries.tpl file, and b) css. I wrote my own template based on bulletproof, however, the default template has this code for the category icons:

Code: Select all

{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}" /></a>
    {/if}
{/foreach}
</span>
{/if}
Immediately after that, is the entry body:

Code: Select all

<div class="serendipity_entry_body">
    {$entry.body}
</div>
The default template's stylesheet has this (don't ask me why, but its in the stylesheet twice...):

Code: Select all

img.serendipity_entryIcon {
    float: right;
    border: 0px;
}
So, if you put that all together, the icon will be rendered first, then entry body. Since the icon is floated right, it will appear exactly the same as my own site.

If you wanted it left, you would float it left. I personally feel it would be confusing at the bottom of the entry, but if that is where you wanted it, I think simply placing the code to occur after entry body should be sufficient, but I have not tested that.
=Don=
ameo
Regular
Posts: 143
Joined: Fri Sep 26, 2008 4:13 am

Post by ameo »

Thanks Don,
i'll try it tonight.
MadFly
Regular
Posts: 56
Joined: Fri Dec 26, 2008 7:47 pm
Location: Cape Town, South Africa

Post by MadFly »

Image I saw this on someone's blog. I have heard that he is a developer or something like that, but i cannot find him.

Does anyone perhaps know how to do this?
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

MadFly wrote:I have heard that he is a developer or something like that, but i cannot find him.

Does anyone perhaps know how to do this?
Hm, hard to guess. Might work with a customized plugin_categories.tpl which also adds the category icons.

Do you have a URL to that blog?

YL
MadFly
Regular
Posts: 56
Joined: Fri Dec 26, 2008 7:47 pm
Location: Cape Town, South Africa

Post by MadFly »

akremedy wrote:
I've recently moved to Serendipity from what became a mostly home-grown (by way of re-invention) blog package. I became tired of the monumental, and lonely dev effort. So much effort went into development, that there was no time/interest in actually posting content.

I'm very satisfied with the flexibility, performance, and feature/functionality of Serendipity.

I'm still doing a lot of fine tuning, but figured I'd go ahead and post a link here: http://www.pigslipstick.com
thats where i saw it. I hope that im not breaking any laws by wanting my blog to look very close to that of pigslipstick...
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

MadFly wrote:I hope that im not breaking any laws by wanting my blog to look very close to that of pigslipstick...
Nah. In fact, I'm pretty sure if you contacted Adam via email or PM, he'd be happy to tell you how to get that look :)

YL
akremedy
Regular
Posts: 56
Joined: Sat Jul 26, 2008 9:06 am
Location: Bay Area, U.S.A.
Contact:

Post by akremedy »

Hi Werner,
I'm happy to help - BTW, check your email for a couple of items that I sent off this morning regarding the login and calendar styling...if you didn't receive anything from me, please let me know.

Here's a post that explains the categories.tpl mod that I made to get the category icons to show up in the Categories list (see item 2 in the post):

http://www.pigslipstick.com/index.php?/ ... hacks.html

... as well as to reposition the corresponding category icon to float right of the blog entry title:

http://www.pigslipstick.com/index.php?/ ... -edit.html

Just remember to stick with icons that consistent in size, and you should be all set.

Hope that helps!
Adam
Post Reply