MT Macro Fun

| | Comments (10) | TrackBacks (2)

!! This tutorial has not been updated since movable type version 2. !!

Learn how to use MT Macro to autolink frequently used text, quick-link amazon items and more! Requirements:

Movable Type, version 2.5 or higher (duh ... lol)
Plugin: MTMacro

1. If you've already installed smilies using MTMacro (click here for the the tutorial on that!), then skip to step two. If not, then start here! Open up MT, go to the templates page and at the bottom of the page, click to create a new TEMPLATE MODULE. Call it autolinks (or really whatever you like!).

2. Open up the your new template module that you just created (or for those of you with smilies already implemented, open up that one) either in MT or in your outside editor if you link templates (which is a smart thing to do!).

3. If you're adding this to the smilies module, just go to the bottom and get ready to add more macros. If you're starting fresh, you'll just add these lines of code for each bit of text that you want MT to recognize and auto-link for you!

[code]BlahBlah [/code]

And we'll go through that piece by piece.

[code]

[code]pattern="m/\bReplace this with the text you want to autolink\b(?!<)/">[/code]

[code][/code]

[code]Replace this with the actual text you want to autolink, like Ebay[/code]

What kinds of things might you want autolinked? I have Ebay, Movable Type (and MT), and most of my dailies I have in there as well. You'll note that even in this post, anytime I use one of the words I've included in my macro, its linking it. See Addie Ebay Jeff Rob MT Tivo Rae Hillary !!

If you had smilies installed via this macro, then you're ready to go. All you have to do is rebuild to get your newly added macros implemented!

If this is your first macro, then you'll need to follow these steps to get everything working:

You'll need to modify each template (main, archive, comments, etc) that you want to have the smilies work on -- which will basically be all of them, unless you don't mind your smilies not showing up on archive pages, etc. Open up each template either in MT, or in your outside editor, and place this line directly below your body tag:
[code][/code]

Now you'll need to edit each of these tags:

(In your main and archive templates)

[code]Change <$MTEntryBody> to <$MTEntryBody apply_macros="1"$>[/code]
[code]Change <$MTEntryIfExtended> to [/code]

Amazon Quick Linking

Do you have MTAmazon installed? If so, you can quickly link to amazon items using MTMacro.

Click here to view that tutorial!

2 TrackBacks

Listed below are links to blogs that reference this entry: MT Macro Fun.

TrackBack URL for this entry: http://www.silverberry.org/x/mt-tb.cgi/1601

Oh my GOD! Amazon links are finally working right. Thank you, Silverberry! I never could get Brad Choate's version (slightly different, similar effect) working; I ran across a reference that it had to do with smart quotes replacing dumb quotes... Read More

I got MTMacros to work for some frequently linked text here on my site, via silverberry's site. The only thing yet not working is the smilies plugin. (>. I had to delete this post before but here it is again,... Read More

10 Comments

:banghead: Noooo.... Nothing happens.. What happens is that when I post some thing like [amazon asin="B0000A2ZNL"]C.S.I[/amazon] My entry is a blank. Just my title and that's all. What's wrong?

oops sorry about that.

nope. It's still blank. help!

I can't seem to get the auto links to work :(

okay... they're work;ing, but my hovers won't come right NEXT to them, but like so under the link. Inn my side page, at www.iltdm.net/side it works fine. Not at www.iltdm.net

okay... they're work;ing, but my hovers won't come right NEXT to them, but like so under the link. Inn my side page, at www.iltdm.net/side it works fine. Not at www.iltdm.net

I tried, and guess what happens. It stretches so far that my page has a horizontal scrollbar! but the popup hovers next to the link, though. ARG!

Oh, my GOD! I finally got this working (mostly). The problem was partly typos in the macro that I typed in (was unable to copy and paste). However, one of the book titles has an apostrophe in it, so I tried to follow directions for encode_js="1" but I'm not sure where to put that. So I sent a correction notice to Amazon.

I tried putting it in the MTEntryBody and MTEntryIfExtended tags, but MT barfed. ;)

At least the majority of my Amazon links are working right, so I'm feeling very S - M - R - T at the moment. :D

Other problems that I think I've corrected: I had an old copy of overlib_js, the link to the script had the wrong blog URL, and I think overlib was also uploaded to the wrong directory before.

Thank you for providing this macro and the macro tutorials.

Your Amazon/overlib macro was similar to Brad Choate's, but I never could get his to work at all, I suspect it was due to "dumb" vs. "smart" quotes.

Okie Dokie. I have what I think is a simple question. My MTMacros are defined and running great. A little too well. Every time the word Nick appears in my entries, they are automatically hyperlinked to a site (the behaviour that should happen). But in one entry I need the word Nick to NOT be touched by the macro. How can I do that? Thanks!

For me, using MT v3.15 - I had to make one small change on the include line:

to this:

Leave a comment

Archives

Pages

Powered by Movable Type 4.1

About this Entry

This page contains a single entry by Lacy published on August 2, 2003 10:10 AM.

Amazon Quicklinking was the previous entry in this blog.

MT Sideblog Tutorials is the next entry in this blog.

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

Flickr