Post
Part 4: Textpattern Pages
I will be leaving this entry in the series largely open because it will likely be covered more thoroughly in Nathan’s article.
Textpattern pages are the basic template for your site. They are displayed based on sections and control the layout of your site. Accompanying page templates are your CSS styles which can also be regulated by sections.
I’ve often heard praise of Wordpress’ easy templating system, but I’ve used both and have found Textpattern’s to be much simpler. The tags have an intuitive XML-style structure and can be easily generated from a more descriptive popup. Also, direct form outputs can be used to emulate PHP includes so you don’t have to modify each page template.
Designing a website for Textpattern is very simple. Simply follow your normal process and then it is only a few minutes process to attach your template to the CMS. Obviously, some details will have to be tweaked within the forms but that is the topic of my next article.
Let us begin by dissecting a basic Textpattern template:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="<txp:css />" type="text/css" media="screen" />
<title><txp:page_title /></title>
</head>
<body>
This can be easily recognized as a basic HTML header. The only differences are the inclusion of the <txp:css /> tag to pull in the CSS from Textpattern, and the <txp:page_title /> tag which outputs a different tag based on the current location and attributes specified within the tag itself. The most comprehensive tag listing and description can be found at the wonderful Textbook.
<div id="container">
<!-- head -->
<div id="head">
<h1><txp:link_to_home><txp:sitename /></txp:link_to_home></h1>
<h2><txp:site_slogan /></h2>
</div>
This is the next part in a basic HTML template, the site title and slogan. Again, the tags are very intuitive due to their structure and naming. For example, creating a link to the home page involves simply wrapping the <txp:sitename /> tag, which outputs the Site Name from the Admin panel, in the <txp:link_to_home> tag, which creates the anchor and link.
<!-- sidebar -->
<div id="sidebar">
<txp:linklist wraptag="p" />
<txp:search_input label="Search" wraptag="p" />
<txp:popup type="c" label="Browse" wraptag="p" />
<p><txp:feed_link label="RSS" /> / <txp:feed_link label="Atom" flavor="atom" /></p>
<p><img src="textpattern/txp_img/txp_slug105x45.gif" alt="textpattern" /></p>
</div>
This part is a sidebar which includes the basic blog features such as a search form and category list. You do not have to worry about remembering or being able to manually create these tags because there are much more descriptive generators for the most useful tags.

<!-- center -->
<div id="content">
<txp:article />
<txp:if_individual_article>
<p>
<txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
<txp:link_to_next><txp:next_title /></txp:link_to_next>
</p>
</txp:if_individual_article>
</div>
<!-- footer -->
</div>
</body>
</html>
This is where the content is called to action. Again, it is all controlled by a very simple yet powerful tag, in this case, <txp:article />. This tag would output any and all content according to the “default” article form. This example is simply showing a basic page template; a more practical layout would probably specify a limit as well as a list form or other specialty. Also, a much wider tag, <txp:article_custom /> gives you much more power over what articles to output.

The next part of this code snippet creates a link to a previous and, if available, next article. However, if you look closely, you will see that the links (following the format of our Site Name above) are enclosed within the conditional tag <txp:if_individual_article>. This means that only on pages where an article is outputted individually will these links appear.
I realize that this article transitioned to discussing tags, but that is essentially what the templating system involves. All you have to do is create an HTML template according to your usual methods and then be comfortable enough with the tags to attach your design to the CMS. Obviously, I cannot describe all of Textpattern’s tags, but what I have tried to do is show how wonderfully easy they are to implement.
Here is my feed if you would like to keep track of the series.
Archive
-
260.
Natural Kinds in Chemistry
One of my favorite courses so far was last semester’s “Natural Kinds”. Everything from the unique subject matter to the seminar-like structure made the class a blast, up until the...
-
260.
The Phenomen- ology of Freedom
Are we truly free? Are the paths of our lives charted beforehand, or is every moment an opportunity to break new ground? The answer isn’t easily found, the determinate physical world seems to hit a...
-
260.
An Open Letter to God.
So here’s the deal, we’ve been here a while doing great things and…eh things, but there’s always been that trickling or gushing concern about why. We’re amazing, when you stop to think...
-
260.
Nietzsche: The Fast Track
The darkly dressed student made yet another existentially pessimistic remark and the professor unleashed one of the harsher insults I’ve heard: “Every student goes: Nietzsche, Schopenhauer,...
-
260.
Computers and God
I came across an interesting presentation on digg (and surprisingly, it wasn’t a kitten with horrifying spelling/grammar) recently that compared – albeit often fallaciously – our...
-
260.
Surviving Life
The questions we ask are not ones we can ponder in our free time and easily set aside when there’s life to do. What am I? Am I free? What is the purpose of my existence? Why should I strive to...
-
260.
The New Erratic Wisdom
Another semester, another redesign (give it a solid refresh to clear your cache). This one’s been brewing for quite some time now, with the notched grid motif coming around a few months ago,...
-
260.
Imperfect Art
Plato’s metaphysics and his Doctrine of Forms describes a general division of our universe into forms and particulars. Forms are instantiated by contingent particulars. That is, particulars are...















Comments
AJ
Dec 9, 09:27 AM #
I’m gonna have a serious look at my structure now.
Dave
Dec 11, 05:43 PM #
I discover new things about Textpattern every day, it really is an amazing CMS.
Thame
Dec 11, 08:55 PM #
artbox
Mar 22, 08:03 AM #
Thame
Mar 22, 09:00 PM #
Barre
May 16, 09:22 PM #
It’s a pity that I did not find your site earlier. Would have saved me lots of time when starting to use Textpattern.
This will give me a boost to apply it seriously.
Uli Spalthoff
Apr 16, 03:53 PM #
Add a Comment
Phrase modifiers:
_emphasis_
*strong*
__italic__
**bold**
??citation??
-
deleted text-@code@Block modifiers:
bq. Blockquote
p. Paragraph
Links:
"linktext":http://example.com