Help - Search - Members - Calendar
Full Version: Images For Categories
Movable Type Community Forum > Using Movable Type > Categories and Entry Tags
rjrasmussen
Hello all,

I'm quite new to both movable type and this forum, and hey...it's my first post!
Here's hoping that's worthy of some help! smile.gif

Although my clients are idiots when it comes to how they want their blog set up, they want to have 8 different categories, all with different header images. Each image has a background with text overlaid to represent each category. Having each category header image as a .gif file seems to be the easiest thing to do, as it fits perfectly into the table and matches the color scheme perfectly.

Anyway...
What I'm trying to do is put some kind of code into my archive index (which obviously shows the categories) that will allow a different image to be loaded based on the category you select.

Is this possible through Movable Type? If yes, what is the full extent of the code needed? If no, does anyone have a suggested alternative to this issue?

Many thanks in advance for your help and support.
OtherNiceMan
Yes it is possible

Create your 8 images, each named after the category. Then in your template you can grab the name of the category, add .jpg, .png or .gif to the end of it, put that in an img tag and there you have it.

Don't have code to hand, will need to look for an example.
danwolfgang
Another option: create an Image custom field to hold the image (though you'll need the Pro Pack).
shenews
QUOTE
What I'm trying to do is put some kind of code into my archive index (which obviously shows the categories) that will allow a different image to be loaded based on the category you select.


I did this a few years ago, with html on MT3.1. I had a group of college students studying abroad blogging from different places. I made each a category, and their category archives were their own blogs. Their names were the categories.

Each category archive had a header table with the linked BlogName on the left and three right-aligned lines: photo, name and location, and school.

The photos are all the same size; both the photo and the category, in urls, are named "firstname_lastname_location.xxx" The category displays however as First Lastname, Location.

Old code (still works) broken out to show the three lines:

CODE
<td width="55%" align="right">
<p><img src="<$MTBlogURL$>thumbs/<$MTArchiveCategory dirify="1"$>.jpg" alt="<$MTArchiveCategory remove_html="1"$>" width="75" hspace="3" wspace="3" /></p>

<p><font size ="2" color="#669966" face="Verdana, Arial, Helvetica, sans-serif"><b><a href="<$MTCategoryArchiveLink$>"><MTCategoryLabel></a></b></font><br>

<font size ="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"><$MTCategoryDescription$></font></p></td>


I'm my own idiot client, but this is what I needed to do, and this was the first attempt that worked.

Maybe someone else will offer a modern upgrade, with nested conditionals.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.