a links database with MT

04 Sep 2003

Inspired by recent articles on how to use Movable Type for more than just blogs, I’ve been trying this out on more areas of the site. The news, articles and album cover playlist sections are MT powered, and now the links database is too. This means I can now add content to the site from either the web or from my weblog editor in NetNewsWire.

The technique has been well documented on many blogs, (wholelottanothing’s is very well written) so I’ll skimp a bit. First I created a new blog called ‘links’ and removed templates I wouldn’t need (such as the stylesheets and individual entry archives). I also set archiving to ‘category’ and turned comments and convert line breaks off. Then I decided which MT tags to use for which piece of data:

I inserted these tags into the main MT Template:


<MTCategories>
<h3><$MTCategoryLabel$> (<$MTCategoryCount$>)</h3>
  <MTEntries lastn="100" sort_by="title" sort_order="ascend">
	<p><a href="<$MTEntryKeywords$>" title="visit <$MTEntryTitle$>">
	  <$MTEntryTitle$></a> // <$MTEntryBody$></p> 
  </MTEntries>
</MTCategories>

This then creates a page, listing all the links within their categories. The tags in the category archives page (where just one category of links is shown) needs to be slightly different:

<h3><$MTArchiveTitle$> (<$MTArchiveCount$>)</h3>
  <MTEntries lastn="100" sort_by="title" sort_order="ascend">
	<p><a href="<$MTEntryKeywords$>" title="visit <$MTEntryTitle$>">
	<$MTEntryTitle$></a> // <$MTEntryBody$></p> 
</MTEntries>

To get the links to display in alphabetical order, add sort_by=“title” sort_order=“ascend” to the MTEntries tag. I used

tags to list each link – you may prefer an unordered list. ‘MTCategoryCount’ shows the number of entries in that category. To make adding links easier, you can customise the ‘new entry’ form in MT, so that it only shows the fields you want to use – Title, Category, Entry Body and Keywords. The last thing I needed to do was create the list of link categories for the main menu. I created a new index template called ‘droplinks.php’ in the links blog, which just contained the following:


<MTCategories>
<li>
<a href="<$MTCategoryArchiveLink$>" title="<$MTCategoryLabel$> links">
<$MTCategoryLabel$> (<$MTCategoryCount$>)</a>
</li>
</MTCategories> 

This is then called up an include in the main navigation under ‘destinations’. Job done.


Next – how to build your own house and landscaped garden using MT…

Recent Posts

It’s just fashion

26 Jun 2018

The Symbol Sourcebook

08 Jun 2018

Differences between Icon and Logo Design on This is HCD Podcast

10 Apr 2018

Twelve South PencilSnap

01 Apr 2018

The Infinite Canvas

09 Feb 2018

Blade Runner 2049

14 Oct 2017

Instagram Hickstagram

  • 14 Jul 2018

    Stopping for a breather - hot day for hills

  • 13 Jul 2018

  • 09 Jul 2018

    Recent garden addition: Stargazer Lillies

  • 07 Jul 2018

    Well… we missed quite a few key acts, but have made it here before Interpol starts at least!

  • 07 Jul 2018

    On our way to BST in Hyde Park. Or… not 😞

  • 06 Jul 2018

    My favourites from this years On Form Sculpture exhibition. The whale was my absolute favourite, but was already sold (which is fine as I don’t have a spare £11,000)

  • 01 Jul 2018

  • 01 Jul 2018

    Not quite in height order. Sort it out

  • 01 Jul 2018

    Filth.

  • 30 Jun 2018

    Agapanthus about to burst forth

Contact us

Call Jon on +44 (0)7917 391536, email or tweet @hicksdesign.

Alternatively, pop in for tea and cake at the studio…

Hicks
Wenrisc House
Meadow Court
Witney, OX28 6ER
United Kingdom