Textpattern 5 | Articles | the bombsite

. . . . . . . . . . .

About the Post

Author Information

I enjoy working with HTML, XHTML, CSS and designers as a web developer. At home I enjoy listening to music, playing music, reading and food.

Textpattern 5

Well it’s been a while but I’ve been a tad busy with another project of late. Let’s get to the nitty-gritty. I’m not going to refer to WP much here unless there’s some dramatic point to make. I’m going to discuss the Presentation section of TXP and if you use WP you can make your own comparison. So first let’s have a little graphic:-

textpattern presentation

When you’ve logged into TXP and clicked on the Presentation tab you end up here in the pages tab. This is where you create your main page templates and TXP will automatically load the default page template when you enter here. You can see along the top of the page that there are 3 other tabs grouped with pages: sections, forms and styles. I’ll deal with each separately but let’s first stay with pages.

On the right you can see a list of all the page templates I use. The only ones to do with my Blog are the default and the archive pages. The rest are to do with the remainder of The Bomb Site. With the exception of fullwidth they all contain the contents that you see when you view the page. In other words they are very similar to normal HTML or PHP pages except that they exist only in the database. I don’t have loads of pages floating around my site or my PC. These pages are what people like to refer to as static pages and each one has it’s own section which we will get to later. The fullwidth page, on the other hand, is just a basic template without any content. It does have it’s own section and all the pages in The Bomb Site that don’t have a sidebar use this template. The difference between fullwidth and the rest of them is that I post to it. If you check out my Layouts section you will see a fullwidth page. What you are looking at is a post where no comments are allowed. The fullwidth template is set-up to accept only 1 post at a time. If you look at the URI address of Layouts you will see that it directs you to a post. So you can see that there are 2 ways of creating static pages in TXP and they are both simple.

So let’s look at a page template and let’s make it the default as that is the one you are now viewing ie my Blog page. First though, in the top graphic just check the left-hand side of the page. This is a menu of TXP tags. You’ll understand them a bit better in a short while but basically if I want to include some specific type of information in my page I can select the appropriate option and I will get a little pop-up which will either contain the tag or it may have other options for me to fill in, then I click a button and it creates a tab. All I have to do is copy/paste the tag into my page where I want it. Here’s your next graphic. It’s a text file representation of my default page that you can see in the centre window in the top graphic.

default page template

Now that may look a little complex but it really isn’t. I’ll prove it. Can you see any PHP? No it’s not a trick question. Can you see any? The answer is “NO!”. That’s because of those TXP tags I mentioned earlier. Let’s examine the page from the top.

First you see what you should see at the top of any decently coded page – the head section with the Doc type definition right at the top. Go down a couple of lines to the first “link rel“. Note the href because that is a TXP tag. There’s another one underneath for the print CSS. A little further down you can see that the “title“ is a tag as is the call to explorer.css in the “If IE“ statement. Yes I send IE users to a different CSS. Don’t like hacks.

Now into the body section. First we have the header which contains a TXP tag that calls the form – header. We will get to forms next but you can think of them as mini-templates so this is calling my header template. Next comes the top block which includes the h1 which is the title at the top of the page between the 2 red lines, a TXP tag calling my hmenu form which is the horizontal menu under the h1 and the Guest Block link text.

Now we get to the complicated bit – Content. A single TXP tag – article=8. Yes folks that’s it – article=8. That little tag represents all that PHP crap you have in your WP index.php file!! Not only that, I tell it here that I want to see 8 articles on the page. That means that within different templates I can vary the article quantity individually for the template. It’s not a blanket decision like you have in WP. If I don’t have the “=8” bit I just get a single article which is how I have it in my fullwidth template that I mentioned earlier. It’s also how the archive template is set up and it’s this that you see when you go to comments. The comments themselves and the comments text area are separate forms or mini-templates. Anyway just below the tag you can see a little bit of HTML which creates the buttons near the bottom of the page to go to newer or older posts.

Next comes the menu section which is another tag call to my menu form, then we have the clearing div followed by the footer section which is the last tag call to my footer form. The End. That really wasn’t difficult was it? So let’s go and look at forms.

textpattern forms

A very similar page to pages but this time on the right is a list of my forms or mini-templates and on the left a different list of tags. You can use other tags but these are the most commonly used ones here. I shan’t do another graphic for the form you can see in the window as you can see all of it here. This is the default form which creates the articles. This is what that article=8 tag is calling. I shan’t go through it all but you can see it is mostly composed of tags and they are fairly self-explanatory. It is a little complicated by the fact that I am using a plug-in that creates extracts and I need to determine whether you are looking at a page with a list of articles or a page with a single article. If it’s a single article you see the whole thing, if it’s a list you see the extracts with a link to the full article. Also at the end is some script for my TrackBack facility. TXP doesn’t come with TrackBack yet so I’m using Haloscan. As you can see I do use a number of forms but I think their titles say it all. On to style then.

textpattern style

You’ve seen this kind of thing before. It’s very similar to the way you create a CSS page in an editor but now it is stored in the database. I only have 2 styles. The default which is what you are looking at or explorer which is what you are looking at if you use IE. So on to sections.

textpattern sections

This was a very large graphic as it is very long so I’ve cropped it but you can still see how sections are defined. If you recall all those page templates I have there is a section for each one here.

People have a problem trying to understand sections in TXP. Some suggest that if we have categories why should we want sections? Well from a hierarchical standpoint sections come above categories. Within your site you can have a number of sections and within those you can have a number of categories. These enable you to split your site up in a very specific manner. You should remember that TXP isn’t just a blogging tool, it’s a light-weight CMS. I think sections are best described in Dean’s own words:-

Sections in Textpattern are perhaps best thought of as analogous to sections in a newspaper: each belong to the same publication, but each might feature a different layout, or a different style of article, and so on.

As you can see from the graphic each section can have it’s own page template and it’s own style so it can look completely different to the other sections and there are some other options to define how it behaves such as whether articles will appear on your front-page as well ie your blog, whether the section is included in the site-search and whether it is syndicated ie appears in your RSS /Atom.

My next TXP article will look at Content which is where all your posts and images go.

Comments ( 4 )

Have you had podz in to do the styling stu ?
7 October 2004, 00:22
Ha ha. No. Don’t you like it then?
7 October 2004, 00:29
Hi Stuart,

You know my site and you have been using TP, so you are a perfect person to ask. Can you see any advantage in me moving to TP? I like what I have seen in it but I have only had a cursory look so far.

Are there any real benefits/disadvantages in what you have seen?

I would really appreciate your opinion…

Thanks

Shadow :)
8 October 2004, 20:12
Hi Shadow. I think that you have to decide how your site is going to develop. For my own part I have found that recreating the static side of The Bomb Site in TXP has been a doddle. The whole site is now included with the exception of my error pages (I’m not sure if I can include these as they need to be available to the host server). A site(s) such as yours would certainly find a good use for the image upload and thumbnails facilities. On the other hand WP certainly has more available “blogging” facilities though as TXP develops it will probably catch up on this side. TXP has to be considered as a very well coded, lightweight CMS with none of the over-bloatedness (?) you usually find with a CMS. Do what I did and set up a test site for a couple of weeks and get into it. If it doesn’t grab you in that 2 week period it’s probably not for you though, knowing your site, I think it is.
8 October 2004, 20:28

Commenting is closed for this article.