TEXTPATTERNPAGES

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.

  1. Great series, and a nice description of the tags. I’ll have to take a serious look at TextPattern now.

    AJ

    Dec 9, 09:27 AM #

  2. Wow, I’ve been using textpattern for a while now and I didn’t even realise it’s full potential.
    I’m gonna have a serious look at my structure now.

    Dave

    Dec 11, 05:43 PM #

  3. Dave:

    I discover new things about Textpattern every day, it really is an amazing CMS.

    Thame

    Dec 11, 08:55 PM #

  4. This is SO helpful. I know the official documentation is there, and will be very useful once I get to know the CMS – but for now, your straightforward explanations are just what I need!

    artbox

    Mar 22, 08:03 AM #

  5. Glad it helped. I think I still have an article or two left in the series so I’ll try to get crackin’ on them.

    Thame

    Mar 22, 09:00 PM #

  6. Wow, the most helpfull guide on the web. Many thanks from Holland for this piece of explanation.

    Barre

    May 16, 09:22 PM #

  7. 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


Show Articles By:

You can show articles by time or category.

  • 260.

    Conscious Conversation: Computation

    This interview is part of a series exploring what different people think about consciousness. The plan is to pose the same basic question to people of different backgrounds (philosophers, religious...

    Read More

  • 260.

    State of the Species

    My fellow humans, we’ve come a long way. Throughout our brief history on earth, we’ve tried to come to terms with a remarkable ability, its source, and what best to do with it. Through relatively...

    Read More

  • 260.

    Conscious Conversation: Science

    This interview is the first of a series exploring what different people think about consciousness. The plan is to pose the same basic question to people of different backgrounds (philosophers,...

    Read More

  • 260.

    On Subjectivity

    Science places a heavy emphasis on the objectivity of the physical world. As a result, consciousness, and specifically its subjective aspect, is often understandably ignored. What interests us is not...

    Read More

  • 260.

    Just Animated Stardust

    “Through science, we human beings are able to grasp at least some of nature’s secrets. We have cracked part of the cosmic code. Why this should be, just why Homo sapiens should carry the spark of...

    Read More

  • 260.

    Prodigious Savants and their Abilities

    Savant syndrome, a condition occurring most often in autistic patients, is a rare disorder where mentally retarded individuals have incredible abilities in isolated fields like memory, mathematics,...

    Read More

  • 260.

    Why Medicine Again?

    Medicine isn’t what it used to be. I’ve talked to alot of physicians, researchers and residents recently and I’m not encouraged by what I’ve heard. What seems to motivate many...

    Read More

  • 260.

    What of the Soul?

    I received a question recently that asked what I thought about the existence of a soul given the relative secularity of most of the content on this site. Soul, Mind, whatever you call it refers...

    Read More