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.
Conscious Conversation: Philosophy
Daniel Black, author of Erectlocution, was kind enough to chat with me one day and we had a great discussion – have a listen.
-
260.
The Stuff in Between
I’m actually almost normal when not agonizing over robot production details, and quite a bit has happened since I last wrote an update. First, I’ve finally graduated. I had a bit of a...
-
260.
The Ethics of AI: Part Three
Is it ethical (or possible) to constrain intelligent life? This part of the argument involves what we think it means to be human, and whether creating and adjusting those criteria in an AI affects...
-
260.
The Ethics of AI: Part Two
Is it ethical to allow humanity to continue, or to replace our species with machines? This is getting tougher. Why does humanity deserve to exist? The recorded history of the experiences of Homo...
-
260.
The Ethics of AI: Part One
Is it ethical to create consciousness? In this discussion, I will make the assumption that we can be assured these beings are “personally” intelligent (i.e. just like us). As we see in nature,...
-
260.
The Ethics of Artificial Intelligence
I am beginning a series exploring some ethical concerns associated with the development of artificial intelligence. Neurobiological evidence points firmly to the brain as the source of human...
-
260.
The Atheist's Purpose
As a lot of the content on this site suggests, I’m an atheist. Being an atheist can be a bit contentious, as many find the lack of an explicit purpose or codified moral laws wrong. So, I’d like...
-
260.
Conscious Conversation: Computation
Dr. Rapaport is an associate professor in the Department of Computer Science and Engineering at the University at Buffalo with research interests in Computer Science, Artificial Intelligence,...


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, 08: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, 02: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