MovableType mass entry edit?
November 18, 2005 10:52 AM   Subscribe

MovableType: I'd really like to go back through every entry in my site and do a regular expression change so that each hyperlink is given a CSS class. Can I do this w/ some clever method?

My last-ditch idea is to dump all the stuff to a text file, do a regexp change on that, and reimport the entries but that would totally suck.
posted by xmutex to Technology (7 answers total)
 
Why not just wrap your MT_Entries in a Div that has an id of "foo" and then just reference .foo>a in your css?
posted by bshort at 10:55 AM on November 18, 2005


Every link? if there's nothing that sets some links apart from others, there's absolutely no reason to do that (btw, classes are not distinctive to CSS--they're part of HTML).

Let's say you only want to target A tags that appear inside blog entries, and you've got the main text of each entry wrapped in a <div class="blogentry"> tag. To style those tags with CSS, just add

.blogentry a {some style: here;}

to your stylesheet.
posted by adamrice at 10:58 AM on November 18, 2005


You can include a css file on everypage and have that css file define the "a" tag to have your style attributes. Note that this will always do that for all "a" tags, so you can't change them individually.
posted by cleverusername at 10:59 AM on November 18, 2005


Response by poster: Aw man, the '.classname a' where each entry is wrapped in a classname classed div idea is so basic and obvious. Thanks :)
posted by xmutex at 11:03 AM on November 18, 2005


For the sake of completeness, I'll note that it wouldn't be hard to use MT's Perl API to effect such a search and replace on the content of blog entries. But the simple pure CSS solution everyone else has already suggested is better for this case.
posted by Zed_Lopez at 12:19 PM on November 18, 2005


Response by poster: I'm still open to ideas: the class'ing of entries works fine but I'd love to be able to update all old entries so it's <a class='bluelink'...> as to be able to vary these classes in future entries.
posted by xmutex at 1:31 PM on November 18, 2005


MT 3.2 has excellent search and replace, for both entries and templates, which would probably do what you were asking for. But there's no reason for it, as you've realized.
posted by o2b at 1:52 PM on November 18, 2005


« Older Is my network secure?   |   Titanic Censorship? Newer »
This thread is closed to new comments.