Textpattern notes Part 1

As and when I get time, I’m going to post some more information about this site’s conversion over to Textpattern. I’m going to evangelise it until I’m blue in the face.

There were quite a few little tweaks I had to make, but here are just a few notes to be getting on with…

Clean URLs for the news feeds

Create your folder structure (such as /feeds/rss/) and place the following code in an index.php file in that last directory:

<?php
header('location: /?rss=1&section=journal');
?>

Just replace ‘rss’ for ‘atom’ if you need that feed too. I’ve also specified that the feed should come from my journal section, but you if you just run Textpattern as a blog you leave this out. Thanks to Drew McLellan of Allinthehead for this one.

Shortstats

In order to get Texpattern and Shaun Inman’s Shortstats working in harmony, I placed the shortstat include at the bottom of each of the section text files in the root. For example, in the ‘article’ file you would have :

<?php
include "./textpattern/config.php";
$s = "article";
include $txpcfg["txpath"]."/publish.php";
textpattern();
include($_SERVER["DOCUMENT_ROOT"]."/shortstat/inc.stats.php")
?>

Mixing hard coded and txp driven pages

In the about section, I needed to do something clever for the ‘about hicksdesign’ page, wheareas the colophon and the contact pages would essentially be just articles.

Using the If_category plug-in by Matthew Moss, I set up the ‘about’ section page to show the hard coded content if the category=hicksdesign, and just a plain article for the others:

<txp:mdm_if_category category="hicksdesign">
....hard coded content in here....
</txp:mdm_if_category>
<txp:mdm_if_category category="colophon,contact">
<txp:article limit="1" form="about" />
</txp:mdm_if_category>

This method is also used to alter the layout between the desktops page and the other downloads pages.

The Hickensian is the journal of Jon Hicks, one half of the creative partnership Hicksdesign. Take a look at the work we do.

playlist 2016

My favourite tracks of the year so far:

Contact

Hicksdesign

73a High Street

Witney

Oxfordshire, UK

OX28 6JA

+44 (0)7917 391 536

Download vCard

Engine Room:

Hicksdesign is powered by Textpattern and hosted by the lovely boffins at Engine Hosting

Engine Hosting