16 Aprili 2003

Context and placeholders

Here is a list of all container placeholders in Movable Type (version 2.63). For placeholders that have them, I have also listed contained placeholders (sometimes by reference) and context-dependent placeholders, along with their meaning in context.

You don’t need to memorize these lists; they’re purely for reference. Hey, knock yourself out if you want to, though; should take you less time than the two days it’s taken me to compile them!

Remember, just for review: “Contained” placeholders will not work outside their container; your template will refuse to rebuild. “Context-dependent” placeholders change meaning inside particular containers.

First, though, I’ll list out the conditional containers, the ones that only do something if some other condition is met. These never have contained or context-dependent placeholders, so they’re easiest. Note that all of these are contained placeholders themselves; you can’t use them just anywhere. Generally the context is evident from the title or description. If it isn’t, that probably means you don’t use the context and so can ignore its contained placeholders.

  • <MTBlogIfCCLicence>: This tag only takes effect if you have assigned a Creative Commons license to your blog.
  • <MTEntryIfExtended>: Takes effect if entry has an extended section.
  • <MTEntryIfAllowComments>: Takes effect if entry has commenting enabled.
  • <MTEntryIfCommentsOpen>: Takes effect if entry comments are still open.
  • <MTEntryIfAllowPings>: Takes effect if entry has TrackBack enabled.
  • <MTCalendarIfBlank>: Takes effect if this cell in the calendar has no date (as at the beginning or end of a month).
  • <MTCalendarIfEntries>: Takes effect if this date in the calendar has blog entries associated with it.
  • <MTCalendarIfNoEntries>: Takes effect if this date in the calendar does not have entries associated with it.
  • <MTCalendarIfToday>: Takes effect if this date in the calendar happens to be today’s.
  • <MTDateHeader>: Takes effect if a given post is the first post of the day.
  • <MTDateFooter>: Takes effect if a given post is the last post of the day.
  • <MTEntriesHeader>: Takes effect if a given post is the first on the page.
  • <MTEntriesFooter>: Takes effect if a given post is the last on the page.
  • <MTNoSearchResults>: Takes effect if a search query turns up no results.
  • <MTNoSearch>: Takes effect if someone presses the search button without entering a search.
  • <MTBlogResultHeader>: If your Movable Type search gizmo searches multiple weblogs (most don’t!), it groups the results by weblog. This placeholder takes effect on the first search result for any given weblog. (The documentation suggests putting the weblog’s name, <MTBlogName>, inside this placeholder, which seems eminently reasonable to me.)

Right. Now for the other containers. I have probably missed some context-dependent placeholders; my brain got to hurting after a while. If you see what I didn’t, let me know and I’ll fix the omission and (of course) credit you.

  • <MTBlogs>: A list of all weblogs dependent on this installation of Movable Type. (For example, one for Yarinareth’s MT installation would include Ravings and Shark Tank as well as CavLec.)

    Contained placeholders: None.

    Context-dependent placeholders: Any that begin with <MTBlog>, e.g. <MTBlogID>. Inside this container, they repeat for all blogs in the system (so <MTBlogID> would list the IDs for all blogs). Outside it, they refer only to your specific blog.

  • <MTEntries>: A list of blog entries. Exactly which blog entries it lists is controlled by attributes on the placeholder. (I’m going to do a whole post on this placeholder eventually. It’s very powerful and very confusing.)

    Contained placeholders: Any beginning with <MTEntry> or <MTEntries>, e.g. <MTEntryTitle>.

    Context-dependent placeholders: <MTComments> inside this placeholder lists comments on a given entry only. Outside it, it lists comments from the entire weblog. Also note that <MTEntries> is itself context-dependent. More on these things in another post.

  • <MTCategories>: A list of blog categories.

    Contained placeholders: None.

    Context-dependent placeholders: Any beginning with <MTCategory>, e.g. <MTCategoryTitle>. Inside this container, they repeat for all categories in the blog. Inside <MTEntries>, they output data only for the categories that apply to a given blog entry.

  • <MTComments>: A list of comments. Precisely which comments depends on which container this placeholder is inside.

    Contained placeholders: Any beginning with <MTComment>.

  • <MTArchiveList>: A list of archive pages. You can choose the archive type (daily, weekly, category, etc).

    Contained placeholders: Anything starting with <MTArchive>.

    Context-dependent placeholders: <MTEntries> lists only entries relevant to the archive type given; if no archive type is given, lists only entries in the “preferred” archive type you set on the Archiving page in Configuration.

  • <MTPings>: A list of TrackBacks received.

    Contained placeholders: Anything beginning with <MTPing>.

  • <MTPingsSent>: A list of TrackBacks sent.

    Contained placeholders: <MTPingsSentURL>, a list of the URLs to which TrackBacks have been sent.

  • <MTSearchResults>: A list of results for a search of the blog via the Movable Type search box.

    Contained placeholders: Any beginning with <MTSearchResult>, as well as <MTBlogResultHeader, <MTEntryEditLink>, and <MTSearchString>

  • <MTGoogleSearch>: A list of search results obtained via Movable Type’s linkage with the Google Search API. (If that made no sense, don’t worry; you don’t need this placeholder.)

    Contained placeholders: <MTGoogleSearchResult>.

Whew. That’s quite a list. I hope it proves useful to someone.

Next up: Placeholder attributes.