textpattern basics - part 3
Posted on March 24, 2006 at 7:56 pm By Ryan in Web DevelopmentWow! Its been a while since I wrote my last textpattern basics article, and life has been quite busy! Well, its back to basics time! So lets talk page forms. Page forms are the heart of each section in a textpattern site. Generally speaking the page form controls what will actually show up on the page.
There are quite a few tags that you can use in a page form, and they do a ton of work! All of the tags mentioned in textpattern basics – part 2 can be used in a page form, along with some key tags to actually show articles…
<txp:article />
The article tag will show one or many articles, depending on how you have it configured. Some of the key attributes that you need to use and understand are form, listform and sortby. The form attribute specifies which article form to use when displaying a single article. The listform attribute specifies when article form to use when displaying a list of articles and of course sortby tells textpattern how to sort the output!
<txp:article_custom />
This tag will do the same as article, just with more options. You still need to use the key attributes from the article tag, but there are a few other key attributes to look out for. The section attribute will let you return articles from specific sections, regardless of where you are in the website, the same is true of the category attribute, but instead of sections it uses categories.
<txp:output_form />
One of the most important tags! This will call a regular form typically a form of type misc and output the form results into the page. This allows you to modularize your code, generally speaking, that’s a good thing!
There are plenty of other tags that you can use in a page form, however I try to keep my page forms limited to tags that call other forms! For example most of my pages look something like this…
<txp:output_form form="DTD_head" />
</head>
<body>
<div id="container">
<txp:output_form form="header" />
<txp:output_form form="navigation" />
..Some article tags and maybe a few div tags etc...
<txp:output_form form="footer" />
</div>
</body>
</html>
That’s it… The pages are pretty simple, allowing the power to be handled by the other forms! I’ll dive into those in part 4, which I’ll be publishing in the next few weeks months, till then – good luck and drop a few comments if you have a question.
Update: I’ve been slammed with buying property, my job and investing in the market. I’ll publish the next segment in my textpattern series soon!
Tags: textpattern
Categories: Web Development



No Responses to “textpattern basics - part 3”
Care to comment?