Textpattern Semantic Model
From Textbook
One of the goals of a tool like Textpattern is to separate the content from presentation, and Textpattern does this very well. In this article we'll look at the semantic model of Textpattern, and the building blocks that make managing content and presentation easy.
Contents |
Main Pieces of the Puzzle
- Sections
- Sections provide the lateral structure in a site and are often reflected by the main navigation menu links.
- Pages
- Pages are XHTML templates to which all content is added, and which are styled as required by Styles.
- Forms
- Forms are discrete, reusable chunks that can contain text, XHTML markup, and textpattern tags. They save you writing the same thing over and over in your pages.
- Lists (e.g. lists of articles) can be given a form so that each item can be formatted in the same way. By default, individual articles are processed by the same form so that all articles are formatted the same way in every section.
- Style
- Styles contain CSS information about fonts, element positioning, etc. Like Pages, Styles are tied to Sections so each section of a site can have a different look and feel.
- Article
- Most generically, an Article is a globally unique block of content. Textpattern attaches properties to these blocks, such as titles, authors, etc.
- Categories
- Categories are a method of organizing articles by the nature of their content - not by their location in the navigation structure. If you cut articles out of the newspaper and put them in envelopes, you'd be matching the effect of categories. You may have an envelope for Britney Spears that had an article from the "entertainment" section and maybe an article from the "birth announcement" section.
- The Britney Spears Category is nothing but a label that was put on Articles to make it easier to search and display information. Categories are not intended to be used as navigational elements.
- Keywords
- Keywords are another method of labelling articles, except they are more for your own use than those of your visitors. For instance, you can search for articles containing particular keywords from the admin side.
- You may display the entire list of keywords in an article to your visitors or (more usually) to search engines in meta tags, or you may use various Plugins which enhance the keywords/tagging ability.
How Things Fit Together
If you have Textpattern installed, log onto the admin area and you'll see the four main tabs that are available - presentation, content, admin, and view site. The admin tab is for configuring the Textpattern install and is discussed in Site Administration. If you click on the view site tab, a new browser window will be opened and you will see the default front page of your new site. What you will be seeing is the default "section" of your site.
1. Section Uses Page Template
You can click the "sections" tab in the admin interface to see more on how this is configured. Textpattern uses the default section for the front page. The front page does not have its own articles; it simply displays articles from all the sections that have the "display on front page" option set to "yes."
If you go to a Textpattern website with the URL www.site.com/cheese/, you're telling Textpattern to load the "cheese" section instead of the front page. At this URL you will only see articles in the "cheese" section.
The section configuration itself contains little information besides what page and what style to use. That's all Textpattern needs in order to load the page template and start the process of rendering the file for the visitor.
2. Page Template Uses Forms
Clicking the "Pages" tab will let you see the templates your site uses, which are essentially XHTML documents. One template may be in use by one or more sections.
Inside a page template are various txp tags which give Textpattern further instructions. The template dictates the overall structure of the rendered HTML page.
In addition to showing article(s) assigned to the section, the structure may employ forms to show repetitive information. For example, a header; a footer; or the manner in which definition lists are displayed, may be defined in a form and reused across many pages.
3. Section Uses Stylesheet Information
If you click on the Style tab, you will see one stylesheet by default. All pages will use this unless another stylesheet is specified. Perhaps you want a different style for the "cheese" section. So you create a new stylesheet with new fonts etc. Then, in the sections tab, select it to be used by the cheese section. Other sections will still use the default styles unless told otherwise.





