Category Icons / Images

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

The pictures come up here properly?!

You can display the images by configuring the categories plugin and setting the XML image to no. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

Oh of course .. I keep forgetting to check in the admin to see if I can do things.

My hoster seems to be down today though, so will have to wait to see if I succeed.

Cheers :)

Nim

p.s
Yes, I'd linked the icons to the wrong places lol, so they do work now.
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

Erm .. well it took away the annoying xml.gif image ... but it also took away my own images :(

Nim
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

And in restoring it .. I've lost my own images completely :roll:



Scuse me a sec ..... Aaaaaarrrrrrrrrrrrrrrrghhhhhh!!!!!

Better now.

Nim
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

How's this for an idea:

- I create a transparent gif that is one pixel by one pixel, save it as xml.gif, and ftp that up to replace the current stupid stinky xml.gif (Image)

- Then I re-ftp my file up there that links to my category images. (My assumption is that it's been written over when I changed the settings).

Would that work?

Nim
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Uh, you can simply disable the xml category icon in the plugin's configuration, and then simply adapt the plugin_categories.tpl file so that your "custom image" code is NOT within the "IF {....}" check that only is executed when you have not disabled xml category icons.

Then your custom icons will still be shown, and xml images will be hidden.

(Your solution would work too, though)

Have fun,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

Hi,

I know I'm being really useless and thick. I wasn't quite sure what you meant by:

"simply adapt the plugin_categories.tpl file so that your "custom image" code is NOT within the "IF {....}" check that only is executed when you have not disabled xml category icons."

No idea at all!!!!
1) How do I make sure the custom image code isn't within IF thingies???
2) Check what is only executed when blah blah .. don't understand that sentence .. sorry :(

Sooooo .. I tried my method .. which you thought would work. It didn't lol. Obviously, making the stupid xml image invisible worked ... but reuploading the file with the links to my images ... well, only one of my images has come up!!!!

I'm so confused. Would it just be quicker if I gave someone else my ftp information and they did it for me????

Nim
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Try to use a plugin_categories.tpl like this:

Code: Select all

    <ul id="serendipity_categories_list" style="list-style: none; margin: 0px; padding: 0px">
{foreach from=$categories item="plugin_category"}
        <li style="display: block;">
<!-- YOUR ICON HERE !!!! -->
    {if $plugin_category.category_name == 'Books'}
    <img src="/Serendipity/templates/competition/img/Books.gif" alt="Books" style="border: 0px" />
    {elseif $plugin_category.category_name == 'CFS'}
    <img src="/Serendipity/templates/competition/img/CFS.gif" alt="CFS" style="border: 0px" />
    {elseif $plugin_category.category_name == 'Depression'}
    <img src="/Serendipity/templates/competition/img/Depression.gif" alt="Depression" style="border: 0px" />
    {elseif $plugin_category.category_name == 'Dreams'}
    <img src="/Serendipity/templates/competition/img/Dreams.gif" alt="Dreams" style="border: 0px" />
    {elseif $plugin_category.category_name == 'General'}
    <img src="/Serendipity/templates/competition/img/General.gif" alt="General" style="border: 0px" />
    {elseif $plugin_category.category_name == 'Pets'}
    <img src="/Serendipity/templates/competition/img/Pets.gif" alt="Pets" style="border: 0px" />
    {elseif $plugin_category.category_name == 'Work'}
    <img src="/Serendipity/templates/competition/img/Work.gif" alt="Work" style="border: 0px" />
    {/if} 
<!-- END OF YOUR ICON CODE -->

            <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>

    <div class="category_link_all"><a href="{$form_url}?frontpage" title="{$CONST.ALL_CATEGORIES}">{$CONST.ALL_CATEGORIES}</a></div>
If that works, try to spot the difference :-) :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

I think I've killed it lol.

I could see quite a lot of differences between the two files.

However, in uploading it, the only difference it seems to have made is to get rid of the tick boxes :| I guess I don't need them, but that wasn't the idea was it lol.

You're giving me so much help, and I'm still being useless ... I'm sorry.

Nim
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

How come the icon for my mothers category keeps working whilst the others don't?

The only difference I can think of is that there are no entries for it.

Gimme a wall .. I need to bang my head against it!

Nim
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Well, but there are no XML images any more?!?! There's no code to show them, so there's no way you could see them anymore. That was the whole goal of it, right?
NimNim wrote:How come the icon for my mothers category keeps working whilst the others don't?
Maybe you check for the wrong category name? What's your code for the "other" categories inside the template file?
The only difference I can think of is that there are no entries for it.
You need to add a IF-statement for every single category icon, of course.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

Yes they're gone! That's only half of the goal though; the other half is to have my own icons there.

I don't know what an IF statement is. The code I've used is below ... they all look the same to me ... so I don't understand why the Mother ones icon is showing.


{if $plugin_category.category_name == 'Books'}
<img src="http://www.sylviathornhill.co.uk/Serend ... /Books.gif" alt="Books" style="border: 0px" />
{elseif $plugin_category.category_name == 'CFS'}
<img src="http://www.sylviathornhill.co.uk/Serend ... ds/CFS.gif" alt="CFS" style="border: 0px" />
{elseif $plugin_category.category_name == 'Depression'}
<img src="http://www.sylviathornhill.co.uk/Serend ... ession.gif" alt="Depression" style="border: 0px" />
{elseif $plugin_category.category_name == 'Dreams'}
<img src="http://www.sylviathornhill.co.uk/Serend ... Dreams.gif" alt="Dreams" style="border: 0px" />
{elseif $plugin_category.category_name == 'General'}
<img src="http://www.sylviathornhill.co.uk/Serend ... eneral.gif" alt="General" style="border: 0px" />
{elseif $plugin_category.category_name == 'Pets'}
<img src="http://www.sylviathornhill.co.uk/Serend ... s/Pets.gif" alt="Pets" style="border: 0px" />
{elseif $plugin_category.category_name == 'Work'}
<img src="http://www.sylviathornhill.co.uk/Serend ... s/Work.gif" alt="Work" style="border: 0px" />
{elseif $plugin_category.category_name == 'Mother'}
<img src="http://www.sylviathornhill.co.uk/Serend ... Mother.gif" alt="Mother" style="border: 0px" />
{/if}
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

Oooooh ... I hate to tell you this ... but having just added an entry to the category of Mother ... the icon in the category list for that category is now not working.

I've done something completely screwey somewhere haven't I!

Nim
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

You enabled the display of the count of entries per category. This will rename you category so you need to check not for "Mother" but for "Mother (1)".

Of course that means everytime you add a new article to a category you will need to edit your template file for the new proper check.

You could use smarty function to strip the (...) count in the variable, but that'S too hard for you (and for me as well, at least I don'T have time to do that for you).

So best owuld be for you to disable the display of the count.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
NimNim
Regular
Posts: 30
Joined: Fri Feb 23, 2007 4:19 pm
Location: Toilet Land
Contact:

Post by NimNim »

Yay!!!!! That's all it was!! I have absolutely no idea why ... don't have a clue about anything PHP at all ... but that worked, and you're a genius.

I'll try and bribe my husband into donating to you this evening (coz I'm penniless).

Thank you so much for all of your help :)

Nim
Post Reply