Warning: Declaration of ThemeSwitcherWidget::update($new_instance) should be compatible with WP_Widget::update($new_instance, $old_instance) in /home/kingston/hitormiss/wp-content/plugins/theme-switcher/theme-switcher.php on line 0
Integrated Quicklinks Tutorial 2

Hit or Miss

Integrated Quicklinks Tutorial 2

After writing my previous tutorial for MoveableType on integrating quicklinks with your main weblog into one column, I absorbed a lot of feedback and other examples and then developed an even better MT template that I’m now using.

My previous template would combine the entries from two weblogs on a strictly date/time order. This new template will arrange the quicklinks into a box at the beginning of each date range (basically sorting by date, by blog ID, and then by time).

The only drawback to this new template is that it requires use of the MTSQL plugin, meaning it won’t work for anyone who’s not using MySQL as their database backend.

  1. Download and install the MTSQL and MTCompare plugins.
  2. In your main weblog, create a new template called “Combined Entries.” The output file should be called “combined.txt” and you should link the template to a file named “combined.tmpl”.

    Paste the following code into the template box:

    <MTSetVar name="openedList" value="0">
    <MTSQLEntries query="select entry_id, entry_blog_id, date_format(entry_created_on, '%Y.%m.%d') as mtdate, date_format(entry_created_on, '%h.%i.%S') as mttime FROM mt_entry where entry_blog_id in (1,2) and entry_status=2 order by mtdate desc, entry_blog_id desc, mttime desc limit 0,20" unfiltered="1">
    <h2 class="date"><$MTEntryDate format="%B %e, %Y"$></h2>
    <p> <MTIfEqual a="[MTSQLColumn column='2']" b="2" numeric="1"></p>
    <ul class="quicklinkBox">
    <MTSetVar name="openedList" value="1">
    <MTIfEqual a="[MTSQLColumn column='2']" b="1" numeric="1">
    <MTIfEqual a="[MTGetVar name='openedList']" b="1">
    <p> <MTSetVar name="openedList" value="0">
    <!-- regular weblog entry --></p>
    <div class="entry">
    <b class="entryTitle"><$MTEntryTitle$></b><br/>
    <MTEntryIfExtended> <i><a href="<$MTEntryPermalink$>">Read More...</a></i></MTEntryIfExtended></p>
    <p class="entryPostscript"><$MTEntryDate format="%X"$>
    [<a href="<$MTEntryPermalink$>"><$MTEntryCommentCount$> comments</a>]
    <MTIfEqual a="[MTSQLColumn column='2']" b="2" numeric="1">
    <!-- quicklink entry --></p>
    <li class="quicklink">
    <a href="<$MTEntryBody$>" class="quicklinkLink"><$MTEntryTitle$></a>
    <MTEntryIfExtended>: <$MTEntryMore$></MTEntryIfExtended>
    [<a href="<$MTEntryPermalink$>"><$MTEntryCommentCount$> comments</a>]
    <MTIfEqual a="[MTGetVar name='openedList']" b="1" numeric="1">
    <p> <MTSetVar name="openedList" value="0">
    <MTIfEqual a="[MTGetVar name='openedList']" b="1" numeric="1"></ul>

    This template works with the assumption that the blog ID of your regaulr weblog is 1, and your quicklink/sidebar weblog is 2. And, depending on the way you have your quicklink/sidebar blog set up (ex, I use the MTEntryBody field to store URLs), you may need to tweak the template format for displaying those entries.

    Here’s the basic idea: we use the SQL statement to sort the entries first by date, then by blog ID, and then by time. We use comparison statements with the entry_blog_id field to decide which template to use in dislaying the entry.

    As we loop through the entries, if the first entry from a date is a quicklink, we print a <ul> tag and set a MT variable that a list has been opened. Then if we later encounter a regular weblog entry on that same date or we reach the end of that date range, we print a </ul> and reset the variable. If you don’t care about setting links from one blog apart from the other with a list, box, etc; you can remove the extraneous conditional tags.

  3. So that the include file (combined.txt) will be rebuilt when you add to/edit your other quicklink blog, create a template in that blog with the same information (linked to the same combined.tmpl file).

    Make sure you specify the directory path correctly. For example, if your Quicklink blog is in a subdirectory of your regular weblog (i.e. “/quicklinks”), you may need to use “../combined.txt” (and “../combined.tmpl”) to point the files in the proper direction.

  4. Finally, we include the combined.txt file in your main weblog page. I use the following PHP code:

    <? include("combined.txt"); ?>

    If you don’t have PHP or SHTML, you can try the MTIncludePlus plugin to insert combined.txt into your main weblog page.

7 responses so far (Respond)


Hi Matt,My mainblog’s Id is 1 and the otherone is 10.how can I figure out the mentioned code?I am new and I do not know which numbers I have to change in the code..

Eric Winther | 25 Jan 2004

Just change b=”2″ to b=”10″

Matt | 25 Jan 2004

Integrated Quicklinks Tutorial
Nice tutorial that explains how to integrate a “quicklinks” blog in with your regular weblog entries. Requires a couple of…

ETC. Indulging my inner geek | 10 Jan 2004

Creating an Updates list for Multiple Blogs
I wanted to display a list of new entries in the past n days to my site drawn from multiple blogs, sorted by Date and then Blog, and allowing different formating for entries from different blogs, without directly querying the…

MT Stuff | 15 Jan 2004

Site Changes
It’s probably not all that exciting to you, but I’ve been working on getting all the various RobbyB blog entries onto one page. Matt’s tutorial has been a godsend. To see the potential, check out the beta blog….

RobbyB.com | 20 Jan 2004

Introducing… my plug
Now, I have something new here. I think it is much better (for me) to have stand-alone section where I…

Warnadunia.NET: eXtended | 25 Jul 2004