boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Category Images

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
tester123



Joined: 13 Jul 2004
Posts: 5

PostPosted: Mon Aug 09, 2004 10:18 pm    Post subject: Category Images Reply with quote

Hi,

I'm thinking about replacing the category-title of each post with a specific image. So that each category has it's own icon, which is displayed at the very beginning of each post.

Unfortunatly I don't know how to do this.
I think it has something to do with the "the_category" function, but maybe it could be solved with some javascript?

Any idea?
Back to top
View user's profile Send private message
Sigg3



Joined: 03 Jul 2003
Posts: 773
Location: Oslo, Norway

PostPosted: Tue Aug 10, 2004 2:54 pm    Post subject: Reply with quote

Derived from http://www.sigg3.net/cafelog/index.php#userimages

Use:
Code:
<img src="/images/<?php the_category_ID() ?>.gif" border="0" alt="<?php the_category() ?>" title="Category">


You need img files named after the ID (1, 2, 3 etc.) of the categories, in this example residing in the /images/ folder. You can also add a

<a href="http://yourserver.com/index.php?cat=<?php the_category_ID() ?>" target="_top">[previous code here]</a> around it, which lets visitors clicking the assigned picture enter the category.

NOTE: This only works within the b2-loop
AND: I've never tried it:D
_________________
VOTE for Female of the Year 2004 NOW!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sh0ck



Joined: 02 May 2004
Posts: 34
Location: Norway

PostPosted: Wed Aug 11, 2004 12:07 am    Post subject: look here Reply with quote

I've used it for quite some time, and it works excellent. There are other ways of doing it, but it takes a lot of unnecessary code work-arounds; this is the easiest way.

Look here: http://www.licklinux.com (same method as Sigg3 recommends)
Back to top
View user's profile Send private message Visit poster's website
Sigg3



Joined: 03 Jul 2003
Posts: 773
Location: Oslo, Norway

PostPosted: Wed Aug 11, 2004 8:56 am    Post subject: Reply with quote

Looks great:D
_________________
VOTE for Female of the Year 2004 NOW!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
tester123



Joined: 13 Jul 2004
Posts: 5

PostPosted: Thu Aug 12, 2004 1:16 pm    Post subject: Reply with quote

Yeah, dirty yet intelligent little hack.
Works perfect.

Thanks a lot! Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group