Help - Search - Members - Calendar
Full Version: Conditional post formatting by category
Movable Type Community Forum > Additional Resources > Tips and Tricks
edb
Does anyone know how to change the look of a post depending upon its category?  

For example, I'd like to insert dated (or non-dated) yellow post-it-like posts containing poetry that are interspersed with (but different in font/background color/size from) my regular blog posts.

Much tx!
nolageek
QUOTE
Does anyone know how to change the look of a post depending upon its category?  

For example, I'd like to insert dated (or non-dated) yellow post-it-like posts containing poetry that are interspersed with (but different in font/background color/size from) my regular blog posts.

Much tx!

Check out Brad Choat's Suplemental Category Tags Plugin.
edb
Do plug-ins work w/ MT 2.0?
girlie
If I remember correctly, support for plugins wasn't added until 2.2. You will need to upgrade in order to use plugins.
edb
I've been loath to take that bear on.  The  installation was difficult enough.  I don't want to destablize things.
girlie
Well - it looks like you would only have one upgrade script to run (mt-upgrade21.cgi).

With an upgrade, the hardest part is just uploading all the new files and making sure they replace the old ones. You don't have to do anything to mt.cfg (unless they're are some new options available you'd like to avail yourself of - but there probably are, given how many versions have been released since 2.0).

Why not read the upgrade manual, and see what you think?
edb
I appreciate the encouragement, and it is tempting.  However, I'm not sure I remember all the files that I or my host modified. For example:

1- i customized the notification email template so that it has a certain appearance.

2- my host customized the file that controls how the notifications are sent so as to accomodate certain anti-spam  constraints.

3- i customized the 'email this post' file so that it sends me a notification when a user emails a post

4 - hmm...oh yes, i also added mt search somewhere and modified the search template

Do you know the names of these files and where they are located?
girlie
It sounds like 1 and 2 are probably in the send_notify function of lib/MT/App/CMS.pm - are you fairly capable of comparing old code to new to see what they may have changed?

Number 3, that sounds like mt-send-entry.cgi, unless you're using David Gagne's popup version.
mcroft
why not put a div around the post with a definition based on category
CODE
<Div class="postbody_<$mtcategory$>">


Then set up the classes in your css and Bob's your uncle...
edb
i'm not a coder, but i am technical.  searching for known code is alot easier than comparing two long streams of spaghetti code. can you suggest any keywords for me to search on to narrow it down in lib/MT/App/CMS.pm and mt-send-entry.cgi?

regarding 4, the documentations says:

QUOTE
if you have modified your search templates in the search_templates directory, do NOT upload the search_templates directory from the upgrade distribution; doing so will overwrite your search templates.
 

i'm not in love w/ how my search template came out, but i worked my banner logo in (somehow), i don't really know how to replicate that success, and i'm also nervous about losing all search functionality.  is the 2.61 MT search implementation easy to link up to the html in my index template, and easy to customize appearance wise?
girlie
QUOTE
why not put a div around the post with a definition based on category
CODE
<Div class="postbody_<$mtcategory$>">


Then set up the classes in your css and Bob's your uncle...

Well, yes - that's the easy way.  ;)

But - you might want to 1) use a different tag and 2) pay attention to capitalization:

CODE
<div class="postbody_<$MTEntryCategory$>">
girlie
edb - in CMS.pm, search for "send_notify". In mt-send-entry, I'm not sure what code you modified, but it's a pretty small file.

Just don't upload the new search_templates/default.tmpl - I never do, I just open it in a text editor and see if I see anything "new" I might want to integrate in my current one.
mcroft
QUOTE
QUOTE
why not put a div around the post with a definition based on category
CODE
<Div class="postbody_<$mtcategory$>">


Then set up the classes in your css and Bob's your uncle...

Well, yes - that's the easy way.  wink.gif

But - you might want to 1) use a different tag and 2) pay attention to capitalization:

CODE
<div class="postbody_<$MTEntryCategory$>">

I suppose you could do it that way, if you wanted it to, you know, work.  Sorry I dashed it off without proofing it, but dinner was in the oven...

Thanks for the correction...
edb
It's good that I keep old emails:  this is a communication from my host that explains what he did to modify the mt notification system so that it worked w/ interland host

QUOTE
You may want to mention my fix to Movable Type so that they can update their product accordingly.

The location of the module in your account is:
cgi-bin/mt/lib/MT/Mail.pm

I changed the following line:
exec $sm_loc, "-t" or

to:
exec $sm_loc, ("-f $hdrs->{From}", "-t") or

This change is on line 52 of the code. This will correctly create a From header in the mail envelope.

Another problem with the mt.cgi program was caused by invalid mail addresses being included in the notification database. These addresses were entries such as "europe", and "demographic". Such entries caused sendmail to complain and spit out unexpected output, eventually causing the mt.cgi program to fail. Simple error checking to ensure valid email address syntax could easily prevent this error from occuring in the future.

If there is anything else I can do to further assist you with this matter, please feel free to re-open this ticket.

Thank you for supporting Interland. We value your continued business.

- Deven

Deven Kampenhout
Product Engineering
Interland, Inc.


not to be too thick, but how do you parse that in english?
edb
Okay, I found the mail file and changed the line!
edb
I now remember that I changed the notification email subject line to show the name of the post.  Would you know where that file is located?
girlie
Again - in lib/MT/App/CMS.pm - the send_notify function.

But that enhancement was already made to later versions of MT, so hacking it shouldn't be necessary.
edb
Okay!  Notsithstanding having lost the category information in my edit posts screen, it went very well.  Now, what's the easiest way to inset post-it note-like interuptions (with poetry) between my normal daily postings?  I can do the poetry, and create a separet poetry category.  I just have no idea how to get such categorized postings inserted into the stream of things.  Many thanks for the inspiration!
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.