Textpattern Pages

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, 06: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, 02:43 PM #

  3. Dave:

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

    Thame

    Dec 11, 05: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, 05: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, 06:00 PM #

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

    Barre

    May 16, 06: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, 12: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.

    The Ethics of Practicing Procedures on the Nearly Dead

    The report from the field was not promising by any stretch, extensive trauma, and perhaps most importantly unknown “downtime” (referencing the period where the patient received no basic care like...

    Read More

  • 260.

    The Ethics of Teaching Hospitals

    I can’t imagine what the patient was thinking. Seeing my trembling hands approaching the lacerations on his face with a sharp needle. I tried to reassure him that I knew what I was doing, but the...

    Read More

  • 260.

    Conscious Conversation: Behavioral Science

    Dr. Eran Zaidel is a professor of Behavioral Neuroscience and faculty member at the Brain Research Institute at UCLA. His work focuses on hemispheric specialization and interhemispheric interaction...

    Read More

  • 260.

    Progress Report

    Two years down, I’m still going. The next two years are my clinical rotations, the actual hands-on training. It’s a scary prospect, responsibilities and such; but it’s equally exciting, after...

    Read More

  • 260.

    Why Medical School Should Be Free

    There’s a lot of really great doctors out there, but unfortunately, there’s also some bad ones. That’s a problem we don’t need to have, and I think it’s caused by some problems with the...

    Read More

  • 260.

    The Cerebellum: a model for learning in the brain

    I know, it’s been a while. Busy is no excuse though, as it is becoming clear that writing for erraticwisdom was an important part of exercising certain parts of my brain that I have neglected...

    Read More

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

    Read More

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

    Read More