« 第202回 | Home | amazonアソシエイタ »

March 26, 2006

カテゴリー別に文字色を変えてみる

メインページのエントリーについて、所属するカテゴリーによって文字色が変わるようにしてみました。

メインページにズラーっとエントリーが並んでいるときに、それぞれのエントリーが何についての記事なのか、ひと目で区別が付くと楽ですものね。
ちょっと見た目も華やかになるしー。

個々の色指定ですが、カテゴリーに紐付けられる項目として、各カテゴリーに「カテゴリーの説明」という入力項目があるので、これを流用してみます。
すでに本来の目的に使っている場合はどうにもなりませんが。

また、全てのカテゴリーにいちいち設定するのは大変なので、最上位の親カテゴリーのみを参照するようにしてみました。

下のようなものを「スタイルシート」テンプレートに貼り付ける。

<MTTopLevelCategories>
<MTIfNonEmpty tag="CategoryDescription">
.<$MTCategoryLabel dirify="1">{
    color: <$MTCategoryDescription$>;
}
</MTIfNonEmpty>
</MTTopLevelCategories>

管理画面から各カテゴリーの「カテゴリーの説明」に以下のように色を指定する。

#ff0077

そして、色を変更したい箇所の適当なdivタグか何かに、以下のようにclass指定を追加してやる。

<div class="hogehoge <MTTopLevelParent><$MTCategoryLabel dirify="1"$></MTTopLevelParent>">

いかがでしょうか。

No TrackBacks

TrackBack URL: http://aklaswad.com/cgi-bin/mt/mt-tb.cgi/25

Leave a comment

OpenID accepted here Learn more about OpenID

About this Entry

This page contains a single entry by aklaswad published on March 26, 2006 12:33 AM.

第202回 was the previous entry in this blog.

amazonアソシエイタ is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.