View previous topic :: View next topic |
Author |
Message |
tester123
Joined: 13 Jul 2004 Posts: 5
|
Posted: Mon Aug 09, 2004 10:18 pm Post subject: Category Images |
|
|
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 |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 773 Location: Oslo, Norway
|
Posted: Tue Aug 10, 2004 2:54 pm Post subject: |
|
|
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 |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 34 Location: Norway
|
Posted: Wed Aug 11, 2004 12:07 am Post subject: look here |
|
|
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 |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 773 Location: Oslo, Norway
|
|
Back to top |
|
 |
tester123
Joined: 13 Jul 2004 Posts: 5
|
Posted: Thu Aug 12, 2004 1:16 pm Post subject: |
|
|
Yeah, dirty yet intelligent little hack.
Works perfect.
Thanks a lot!  |
|
Back to top |
|
 |
|