Toot - Part 1
Toot - Part 2
Toot - Part 3
Toot - Part 4
Toot - Part 5
Toot - Part 6
Toot - Part 7
Toot - Part 8
_ Test Article 1
_ Test Article 2
_ Test Article 3


Toot - Part 7 · 9 June 04

A simple TextPattern Tutorial
Part 7 – Creating a new Section.

In this part of the tutorial, you will need your ftp program.

In an earlier part, you made changes to the about section. Now you will create a new section called testsection.

1. Click on the presentation/sections tabs.

2. When the page opens, at the top in the box next to “Create”, type in the word testsection and click the Create button.

3. When the page refreshes, scroll down to the new testsection section. Change “uses page” from “default” to “archive”.
Change uses style from “default” to “teststyle”.

4. Click the Save button at the bottom of the testsection section.

5. Now, notice the teeny little button with *!* on it, next to the word testsection. Click that button.

6. Read and follow the instructions:
You are using clean URL mode, and have created a section for which there is no corresponding placeholder file in your site directory. No big deal, just create a text file (not a directory!) called testsection in /home/YOURPATH/APPEARSHERE and paste the following code inside it:

include "./textpattern/config.php";
$s = "testsection";
include $txpcfg["txpath"]."/publish.php";

(Place it in the same directory as the about file and the article file.)

b. open up the .htaccess file in /home/YOURPATH and paste this at the bottom:

<Files testsection>
ForceType application/x-httpd-php

(Some ftp programs hide these types of files, you may have to unhide it to see it.)

A BIG NOTE If you are not using Clean Urls (under admin/preferences). you probably don’‘t have to create the testsection file or make the .htaccess change to make your new section work. However, you really will learn something if you do.

A TIP Save a copy of your modified .htaccess under another file name. If you upgrade TextPattern “in-place”, you will probably overwrite .htaccess, causing your hand-made sections to stop working. You can swap the saved version back in after doing the upgrade.

7. After you have done that, the little *!* button will disappear.

8. Now click the content/write tabs, and then select Test Article 3 from the list at the bottom of the screen . On the right side, look in the Sections drop-down box, and change it to “testsection”. Save your changes.

9. Click on “view site” from the topmost menu. Click on
Test Article 3. It will now use your new “teststyle” section. It will appear the same as Test Article 2, which uses the “about” section, because both of these sections use the archive page template and the teststyle stylesheet.

10. Click on “presentation/sections” and play around, changing the uses page and uses style for your new “teststyle” section and see what effect your changes have on the appearance of Article 3.

11. Go back to Toot 5 and create a third stylesheet. Call it teststyle2, but this time change the background color to #7890ab instead.

12. Now go to presentation/sections find the “testsection” section.
In the “uses style” area, select “teststyle2” from the drop down box.

13. Click the Save button at the bottom of the testsection section.

14. View your site again (refreshing the screens if necessary). You will see that each article now has a different color background, because each is using a different section, and each section now is using a different stylesheet.

You made it! Congratulations!

This tutorial has covered a lot of ground. You should now have some idea of the interplay between page templates, stylesheets, and sections.

For the curious, there is a very short Tutorial – Part 8.

* * *