Textpattern Sections

Part 3: Textpattern Sections

Textpattern Sections are by far the most misused aspect of Textpattern and I am often guilty of employing them when they are entirely unnecessary. Textpattern sections are strong content and presentation dividers and are powerful enough to create different blogs or websites from the same installation.

Separate sections should only be used if you are trying to:

Sections should not be used solely for content division; there are categories for that purpose as well as other external tagging services.

Creating a section is a simple process (Presentation > Sections > Create), but it is the features of each section that is important. Under each section are eight items (In version 4.0.2 anyway, I believe there were six in earlier versions?). These items will dictate how your section will function. Let’s go through each:

Section name: This is used mainly to determine the URL if you have chosen (and are able) to have “clean” permalinks. You will refer to these names in any tags (i.e. <txp:if_section name="about,archive">).

Section title: This is the title of the section that is displayed by the <txp:page_title />. This is usually the same as the section name except with a capitalized first letter for appearance.

Uses page: This is one of the more important section properties because it allows for a completely different structure depending on the section. In a typical installation, you should have three page templates:

I don’t want to go too in-depth because I have a separate article for page templates, but the beauty of Textpattern is clearly visible here. It is such a simple and elegant system that you can run a full website with only a couple templates and a handful of forms.

Uses style: This has a similar function as the “Uses page” and allows the user to apply different styles to different sections. For example, you can manually insert the base style into the header and then include an “open” <txp:css /> that perhaps applies a particular color scheme to each section.

Selected by default: This is more of a convenience than a feature; it is used to select which section is the default when writing a new article.

On front page: This feature determines whether or not articles posted to the section appear on the front page. Sections that do appear on the front page are then picked up by the “default” section which is the front page of your website. You can not post directly to the “default” section, but articles you want to appear on the front page should be posted to a section with this feature on.

Syndicate: This one is fairly self-explanatory: if yes, articles in the section will appear in the main feed. Generally “static” sections should not be syndicated because the articles they contain will usually be “About” or “Contact” articles.

Include in site search: Again, self-explanatory. I haven’t come across any instances where sections should not be searchable, but if you ever need it…it’s here.

A quick tip to remember when modifying any of these settings is that you must save each section’s changes individually (using its own “save” button). I’ve wasted a lot of time trying to figure out what I was doing wrong when it turned out that I was always pressing the save button at the bottom of the page.

Some important tags are:

The <txp:if_section> tag is obviously quite powerful and is processed correctly almost everywhere. Some places I use the tag is in my pages’ <title> tags so that static sections only output a more detailed title (also involves the ob1_title plugin). Another example use is in advertisement tracking. I have a number of conditional tags that output a specific channel ID depending on the section.

That is a quick overview of sections and what you can do with them. Again, if I neglected to mention or discuss something please leave a comment and I’ll add it in. Also, I must apologize in advance if I’m late with the next article. The hectic Final’s Week is about to begin in my first semester of college and I really must focus on my studying…you wouldn’t want me to do badly now would you?

Go ahead and grab my feed so you know when the next article is ready.

Add Your Thoughts

Textile Tips

  • _emphasis_
  • *strong*
  • "link text":http://link.url
  • ??citation??
  • @code@

Subscribe

Forum

Charity of the Month

Recent Comments

9rules Members

Academics Blog Top Sites

Sponsored Ads

Links

Buzzword Hell - The condemned ones include: "GYM Free", "Folksonomy" and "Social Networking"

Performancing Firefox Extension - A Firefox extension that allows you to write to your blog from within the browser. If you use Textpattern, you'll need the XML-RPC.

FACE - Faruk's Animated CSS Enhancements.

ExpressionEngine - pMachine has released a "core" version of EE with limited features and a nice pricetag: free. I might have to try it out.

Javascript Image Resizing - Smooth. Apperently, this is what iPhoto does...I really want a Mac.