blog archive contact about feed

Using ExtraFields In Movable Type

I've been doing some work with Movable Type using the ExtraFields plugin recently.

One problem I had was offering an alternative if an extra field hadn't been set. It turns out that it's possible to nest an <MTElse> in the <MTIfExtraField> tag.

Here's an example. I have an extrafield called externalurl on an entry, if it exists I want to use that for the link, if not I want to use the entry's permalink.

<MTIfExtraField field="externalurl"> <$MTExtraFieldValue field="externalurl"$> <MTElse> <$MTEntryPermalink$> </MTElse> </MTIfExtraField>

This basically gives us the functionality of a <MTElseExtraField> tag.

Entered: 2008-04-02 16:12:42
TRACKBACK - http://www.robertprice.co.uk/cgi-bin/robblog/trackback.pl?id=987

Rob's Other Blog Entries

See other blog entries for April 2008, or an index of all blog entries.