IPB

Welcome Guest ( Log In | Register )

Movable Type

We're moving to movabletype.org!

At long last, we're moving to forums powered by, well, Movable Type itself. You'll want to bookmark http://forums.movabletype.org/ for future reference, and in the meantime you can view these old forums as a read-only archive of past posts. Thanks for being part of the community!

 
Reply to this topicStart new topic
> Category Imagery
youthurban
post Nov 14 2003, 01:40 PM
Post #1





Group: Members
Posts: 50
Joined: 19-July 03
Member No.: 13,638



Right to it:

Already, I've inserted an image file into the main index, which, appears above the title of each entry. [Insert Applause]

But, I want the image to change, according to the category. I have two categories of entries: politics and prose.

How do I make an image correspond to a category? (Take a look at my site: particularly the peace sign.

The code thus far--

CODE
<MTEntries lastn="15">
<h2><center><img alt="Peace.gif" src="http://www.youthurban.com/archives/Peace.gif" width="54" height="60" border="0" /></center><$MTEntryTitle$></h2>
<div>
<$MTEntryBody$>
</div>


Again, how can I alter that code to use multiple images (which correspond to particular categories)?

--tryiN
Go to the top of the page
 
+Quote Post
Jake_S
post Nov 14 2003, 01:59 PM
Post #2





Group: Members
Posts: 4
Joined: 14-November 03
From: Somewhere over there...
Member No.: 17,743



What I would do is have an image with a filename that corresponds to the <$MTEntryCategory$>. One limitation (unless you want to go into content negotiation, etc.) is that any category images will have to be the same type. i.e., .gif, .jpg, .png.

Using your example, I'd do something like:
CODE
<MTEntries lastn="15">
<h2><center><img alt="<$MTEntryCategory$>.gif" src="http://www.youthurban.com/archives/<$MTEntryCategory$>.gif" width="54" height="60" border="0" /></center><$MTEntryTitle$></h2>
<div>
<$MTEntryBody$>
</div>


Thinking on it some, and remembering a CSS fiasco that occurred when I was switching over to MT, I'd probably make that img<$MTEntryCategory$>.gif, and have a backup "img.gif" file lying around just in case I forgot to assign a category to a specific entry.
Go to the top of the page
 
+Quote Post
youthurban
post Nov 14 2003, 02:06 PM
Post #3





Group: Members
Posts: 50
Joined: 19-July 03
Member No.: 13,638



Stupid Question:

How does a particular category correspond to a particular image?

I use two categories: politics and prose. And I have two graphics, one for each.

:Thank You
Go to the top of the page
 
+Quote Post
Jake_S
post Nov 14 2003, 02:16 PM
Post #4





Group: Members
Posts: 4
Joined: 14-November 03
From: Somewhere over there...
Member No.: 17,743



Ok, in your MT setup, you have your specific categories. Let's make up some for example purposes. You have a Peace.gif file, so let's make a category called "Peace" in MT, if there's not one now. Now let's also add "War", "Famine", "Death", "Pestilance", and "FuzzyLemons". Note there's no spaces in these catgory names. It'll make your life less complicated if you're hosting on a Unix/Linux/BSD system.

We have our category names. Now we're going to make some .gif files. And since this is an example where I get to make the rules tongue.gif, we're going to include my corollary, and name them imgPeace.gif, imgWar.gif, imgFamine.gif, and so forth. We're also going to have a fall-through image named "img.gif" just in case we forget to assign a category to the entry.

Now if you look at the code block in my first reply, you'll see that I'm using the <$MTEntryCategory$> tag for the image source and the image alt tag.
Go to the top of the page
 
+Quote Post
Jake_S
post Nov 14 2003, 02:19 PM
Post #5





Group: Members
Posts: 4
Joined: 14-November 03
From: Somewhere over there...
Member No.: 17,743



Ok, I didn't see that you just had the two categories. It's still the same concept. You'd just need to make sure you have 2 images, politics.gif and prose.gif, and make sure you always assign a category to each entry, or you'll end up with the broken image icon in your browser.
Go to the top of the page
 
+Quote Post
youthurban
post Nov 14 2003, 03:01 PM
Post #6





Group: Members
Posts: 50
Joined: 19-July 03
Member No.: 13,638



Jake S:

Stranger, whutup? ...Gracias. Got it done.

Now, onto the next: my category archive pages are controlled via the category template. However, I cannot customize their appearances to correspond to the actual category. In other words, all category pages are identical except for the entry content.

Is there a simple way to customize their appearances? Say, have one appearance for prose, and a separate appearance for politics?

:Thomas V
Go to the top of the page
 
+Quote Post
Jake_S
post Nov 15 2003, 08:21 AM
Post #7





Group: Members
Posts: 4
Joined: 14-November 03
From: Somewhere over there...
Member No.: 17,743



QUOTE (youthurban @ Nov 14 2003, 05:01 PM)
Is there a simple way to customize their appearances?  Say, have one appearance for prose, and a separate appearance for politics? 

Pretty simple, actually.

Two distinct ways I can think of, but I'm just going to go with the simplest (IMO) since it's early in the morning, and I'm not thinking very strongly right now.

Create 2 extra stylesheets that override the specific aspects you want for prose and politics. Name them "styleprose.css" and "stylepolitics.css".

Now in your category archive template, somewhere between {head} and {/head} (replace "{}" with appropriate angle brackets) , put in the following:

CODE
<style type="text/css">
@import url("/style<$MTArchiveTitle$>.css");
</style>


That should do the trick.
Go to the top of the page
 
+Quote Post
youthurban
post Nov 17 2003, 01:06 PM
Post #8





Group: Members
Posts: 50
Joined: 19-July 03
Member No.: 13,638



Alright, using Internet Explorer from a Mac, the category-assigned graphics appear. However, they don't appear, when viewing the page using IE from a Sony.

Why not?

The code I've used is as follows--

CODE
<MTEntries lastn="15">
<center><a href="http://www.youthurban.com/archives/cat_<$MTEntryCategory$>.html"<img alt="<$MTEntryCategory$>.gif" src="http://www.youthurban.com/archives/<$MTEntryCategory$>.gif" width="89" height="112" border="0" /></center></a>

<h2><$MTEntryTitle$></h2>
<div>

<$MTEntryBody$>


Why won't Windows XP recognize the photos? They don't appear at all.

(NOTE: Here's a link to past discussion on this topic.)

Gracias before,

http://www.youthurban.com/thomascarrow/

EDIT: Topics merged

This post has been edited by maddy: Nov 17 2003, 01:33 PM
Go to the top of the page
 
+Quote Post
youthurban
post Nov 17 2003, 01:16 PM
Post #9





Group: Members
Posts: 50
Joined: 19-July 03
Member No.: 13,638



You not alert. Add a carrot, stupid.
Go to the top of the page
 
+Quote Post
maddy
post Nov 17 2003, 01:34 PM
Post #10





Group: Members
Posts: 6,743
Joined: 23-July 02
From: Christchurch, New Zealand
Member No.: 3,469



QUOTE (youthurban @ Nov 18 2003, 10:16 AM)
You not alert.  Add a carrot, stupid.

Is that meant to mean something? huh.gif
Go to the top of the page
 
+Quote Post
kadyellebee
post Nov 17 2003, 02:40 PM
Post #11





Group: Members
Posts: 8,577
Joined: 11-October 01
From: Vancouver, WA
Member No.: 777



The images are showing up in both Mozilla Firebird and IE6 now. So I don't have any idea what the carrot comment was!


--------------------

start here - forum readme! | MT Wiki - FAQ

irtual enus | mt-plugins | plugin manager (beta 0.1.8)
kdlb | collectics | love | blogplates ring | trk
blogstyles: easy to use stylesheets for MT blogs!
Need an easy answer? TypePad! Blog and hosting all in one!!
Go to the top of the page
 
+Quote Post
urbandyke
post Nov 17 2003, 02:55 PM
Post #12





Group: Members
Posts: 441
Joined: 5-May 02
From: St Charles MN
Member No.: 1,301



Bugs Bunny visited the message boards, maybe?
Go to the top of the page
 
+Quote Post
youthurban
post Nov 20 2003, 03:34 PM
Post #13





Group: Members
Posts: 50
Joined: 19-July 03
Member No.: 13,638



Rascals:

The coding lacked a necessary (end) carrot. See if you can find it. Give up,

CODE
egory$>.html"<img alt="<$MTEnt


Tricky, huh?

:Bugs Bunny
Go to the top of the page
 
+Quote Post
Coyote
post Nov 20 2003, 04:37 PM
Post #14





Group: Members
Posts: 27
Joined: 24-October 02
From: Trenton, NJ
Member No.: 5,323



For others who might find this category through searching later ... you can also use images in relation to categories, even when the category is named with multilple words.

i.e.: You have a category called My Daily Life and another called Ranting. You want images to represent either category. This is what you would do:

CODE
<img src="<$MTEntryCategory dirify="1"$>.gif">


This would make your categories read out as: my_daily_life and ranting (strictly in the URL for the image) and rid any spaces. You would then just have your images titled the same: my_daily_life.gif and ranting.gif

I use this myself to show which categories I have my entries in, and it works beautifully.
Go to the top of the page
 
+Quote Post
se99jmk
post Feb 24 2004, 02:13 PM
Post #15





Group: Members
Posts: 50
Joined: 22-February 04
Member No.: 21,392



what happens if you assign multiple categories to entries? which image would it try and use? or would it try to render all of them?
Go to the top of the page
 
+Quote Post
medic119
post Feb 24 2004, 02:24 PM
Post #16





Group: Members
Posts: 848
Joined: 5-March 02
From: Fairbanks, AK
Member No.: 769



It renders them all. See my site and look for an entry with multiple categories for an example.

And just to end the debate, youthurban is wrong.

> is greater than
< is less than
and
^ is CARET (not carrot)

smile.gif


--------------------
Doc, 68W2P, AAS, NREMT-P
Far From Perfect
"So Shut Up, Live, Travel, Adventure, Bless, And Don't Be Sorry." - Jack Kerouac
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 02.09.10 - 10:47 PM