The Typo3 Project

A Conservative Cat Web Page

On April 8, 2006, after three days spent attempting to update the NMPDR genetics web site, my pet Bruce decided the only way he could learn how to use the Typo3 content management system was to completely rebuild the site from scratch. This is his story.
04/08/06, 12:30pm Downloaded Typo3 version 4 in TAR format. I need to find a place to put it, but I don't have sufficient security privileges to put in on any of the machines at work.
04/08/06, 01:10pm Decide to upload it to the Conservative Cat site. Ferdy wants to get paid for the use of his web space, so I send an expense report to Accounting for one pound of Sargento mozzarella cheese. Downloading the ZIP version of Typo3 version 4, because the TAR version can't be uploaded via FTP.
04/08/06, 05:36pm Suddenly realize that the installation instructions in the book only work for version 3. Delete all of the messed-up files and start over.
04/08/06, 06:32pm Upload still going. Reading the book to learn how to use the Typo3 programming language (TypoScript), even though the book is version 3 and I'm using version 4.
04/08/06, 06:43pm

Book uses the following script code as an example of how to draw a line.

page = PAGE
page.typenum = 0
page.20 = HRULER
page.20 {
   lineThickness = 10
   lineColor = #e6e6e6
   space:eft = 100
   spaceRight = 100
}

Starting to feel the symptoms of a panic attack.

04/08/06, 07:06pm Upload complete.
04/08/06, 07:30pm Install tool is not working. Decide to look for documentation online.
04/08/06, 07:40m Research Central page at Conservative Cat looks awful. Decide I need to learn how to do CSS styles for table.
04/08/06, 08:50pm Decide that attempting to learn how CSS works is a sign of insanity.
04/08/06, 09:05pm After all that, no clue in the online documentation. It appears, however, that instead of taking you through the install process one step at a time, the installer requires you to click on the little list at the top to go directly to the install step you want to take. Click on step 1 and discover a whole bunch of directories are missing. Decide to print the list.
04/08/06, 09:11pm Fixed the stupid fricking printer. Now creating missing directories.
04/08/06, 09:38pm Almost done with basic configuration. The reason it didn't go through the steps in order is that it found a connectable database already on the site. Telling it to create a new database and use that one. When I press the UPDATE button, it will either configure my installation or completely screw up everything.
04/08/06, 0944:pm Everything worked but the database. It was determined to use the database it had already found. I updated the configuration file by hand to fix this.
04/08/06, 09:47pm Database has no tables in it. To get the tables, you have to click the IMPORT link and then tell it to go ahead and fix the tables. This seems to have no relationship to the instructions on the install page, which tell you to pick an SQL script file to run.
04/08/06, 09:53pm The default install is in compatability mode so that it works with data from version 3.8. Since this is a completely new install, I tell it I want to be in real 4.0 mode. In order to do this, I have to check all the boxes on the page to prove I know the terrible risk I am taking.
04/08/06, 09:57pm Ferdy's web server has ImageMagick installed, but Typo3 can't find it. Try telling the Basic Configuration page to look for it in the correct directory, but it doesn't work. Finally go into the All Configuration page to set the parameter directly. I also have to tell it that it's ImageMagick version 5 instead of version 4. The All Configuration page is step 5, and the ImageMagick verification step is step 4, so it's a good thing I can visit the pages out of order.
04/08/06, 10:11pm Finished configuring ImageMagick. Note that all the test images are of Jesus Christ, which I believe is Not Safe For Work if you work in a government lab. Glad I'm working at home.
04/08/06. 10:12pm Next two install steps were to clean up temporary files created by the ImageMagick tests. This proves to be wonderfully rewarding.
04/08/06, 10:15pm Finally I can log in to the web site. Typo3 has two entry pages: the front end for users, and the back end for editors and administrators.
04/08/06, 10:21pm Still unable to login: the user ID and password I created during setup do not work. Create new administrative user with the installer and verify that it doesn't work either. Wondering if the phrase "back end" has multiple meanings.
04/08/06, 11:48pm Changed the login mode to "superchallenged". Previously, this field was allowed to default because the installer said the default was "superchallenged". Login suddently works.
04/08/06, 11:53pm Verified that login still works even if I end a browser session and come back in.
04/08/06, 11:55pm Login page has an angry yellow box telling me I need to do a reference check because the references table is wrong. Go to reference check page where it says the references are all correct. Unable to find my way back to the login page to find out what to do next, so I have to log out and back in. Planning to ask for a pain and suffering raise on Monday.
04/09/06, 12:01am There are no pages on the site, and there does not appear to be any way to create one. I do find the log, however, and it's full of messages about some poor loser frantically trying again and again to log in over a period of 90 minutes.
04/09/06, 12:06am Finally find a Create New Record button on the List Mode page. Creating a new record causes a page to appear.
04/09/06, 12:11am Looking at the new page brings up a large, complicated form for me to fill out. Decide to use the wizard instead. The wizard asks me where I want to put the new page and then brings up the very same large, complicated form. Decide to get the stupid book out of the wastebasket and hope that version 3 instructions for editing pages will work in version 4.
04/09/06, 12:20am The large, complicated form turns out to be what is known as the page header in Typo3 v3. In Typo3 v4 it's called the page properties. The only required field is the title. Save the page (with title), then click on the page icon and a little menu appears. I choose EDIT, and for the first time see something that looks similar to the content editor we have on the old site.
04/09/06. 12:32am I start reading the book again. In Typo3, a page consists of three elements—a template which describes the layout of the page, and content, which describes the text and images to be displayed on the page. I suspect, but am not entirely sure, that the third element is a style sheet. Beginning to wonder if author of book could be a frustrated mystery writer and thinks I'll enjoy the book more if he keeps me in suspense. I create a content element.
04/09/06, 12:48am Entered the NMPDR welcome text into the new content element, then saved everything to see if the page would show up. Discover that new pages are hidden by default. Edit page to turn off the Hide flag and try again. Instead of a no pages found message I get a no template found message.
04/09/06, 12:52am Skip ahead in book to the chapter on templates. It tells me to use the Create New Website button on the Template Tools page. I press the button and get an alert box asking me if I'm sure I want to do this. Decide to lie and click OK. Find myself back on the Template Tools page. The Create New Website button is gone and in its place is a bunch of data about how there are no constants to edit. I click on the only clickable thing: NEW SITE.
04/09/06, 12:59am The page shows up, but all it says is Hello World. Apparently, the default template is to ignore any content and display a stupid greeting. While investigating, I learn that the title bar of a page is a combination of the web site title from the template and the page title from the page record. I change the web site title to NMPDR and the page title to Home. NMPDR Home is a little less goofy than New Site NMPDR.
04/09/06, 01:10am The two key parts of a template are constants and setup. Constants are supposed to be global values that you can set once and then use throughout the web site. The setup contains statements in a pseudo-script language called TypoScript. I put in some constants that I know I'm going to need.
04/09/06, 01:37am

Changed the Setup for the root template to the following.

	page = PAGE
	page {
	  10 = TEXT
	  10 {
	    value = NMPDR!
	  }
	}

This creates a page called page and puts a text object called 10 on it. The value of the text is NMPDR!. Still no clue how to get the real content onto the page. I believe the significance of 10 is that the page elements are ordered by name. The first element would be 10 and the second would be 20, and then if you need to put something in between it goes in position 15. I think the idea is to bring back memories of the line-numbering schemes used back in the days of punch cards. Expecting to have nightmares about this.

04/09/06, 01:40am I am concerned that the static templates mentioned in the book don't exist. These templates are supposed to make it easier to generate the various types of pages used in a normal site, but the static template list is empty. Perhaps they aren't used in 4.0. The install document mentions a thing called testsite.zip, and perhaps this contains an SQL script for creating the static template records. I cannot find this file anywhere, however.
04/09/06, 02:53am

While looking for information in the book about the static templates, I accidentally find the on displaying content. Well, actually, it's not a section, it's a paragraph buried in the middle of a list of object types. The following code fragment displays content on the page. The colPos value of 0 indicates we want the content for the normal column. The other columns are left, right, and border, but I don't know which numbers they are.

    page = PAGE 
    page {
      stylesheet = fileadmin/NMPDR.css
      20 = CONTENT
      20.table = tt_content
      20.select {
        pidInList = this
        orderby = sorting
        where = colPos=0
     }
   }
   
04/09/06, 02:57am Decide to get some sleep.
04/09/06, 06:37am Run some experiments. Apparently, the css_styled_content static extension template is required to get the above code to work. I suspect it defines the tt_content stuff used above. Begin searching the TYPO3 web site to determine if there are extensions already in existence that will do what I want.
04/09/06, 07:26am Back to sleep.
04/09/06, 11:24am Begin installing extensions. The phpMyAdmin extension warns me it may not work with my version of PHP and Typo3. I cheerfully ignore the warnings. I also add an extension for framing external web pages as content (iframe) and one for developing new extensions (Extension Kickstarter).
04/09/06, 11:56am The extension manuals are written in OpenOffice format. They have OpenOffice at my wife's church, so I am familiar with it. I decide it would be less painful to shoot myself in the foot.
04/09/06, 12:03pm I need to be able to create extensions, so I turn to the chapter in the book on extensions. The example extension is a simple visitor counter. I want to be able to do dynamic modification of content items, so the example is probably useless. I forge ahead anyway, because I'm a contractor for the United States Government and here in Illinois we pride ourselves on useless government contracts.
04/09/06, 12:20pm The extension kickstarter page doesn't work, because the active links are attached to a graphic that is not available. The graphic is there, it's just in a different directory. I decide I need to copy the gfx directory to the t3lib directory. When I set this up at work, I'll use a symbolic directory link to save space.
04/09/06, 01:05pm The book tells me what to type, but doesn't explain why. Starting to think this example is more useless than I thought.
04/09/06, 01:10pm The book says the next step is to add a plugin, but doesn't say which kind. I look at the picture on the next page, and it looks like I want a Front End Plugin. The book says to enter a title and "set a few more options". Thank you so very much.
04/09/06, 01:17:pm "Finally we add Static TypoScript Code and use View Result. Of course, it doesn't say what code to add, so I hope it means none. The viewed result is an extremely large listing of PHP code. The book says to click WRITE, so I do.
04/09/06, 01:20pm My extension framework is now ready. The book says this process should have taken 4 minutes. God help us all.
04/09/06, 01:25pm As far as I can tell, the kickstarter didn't do a single thing. The new table is not in the database, and the extension files are not where they're supposed to be.
04/09/06, 01:35pm It was only 10 minutes this time. As a precaution, I use the DL as File button to download the kickstarter data to my laptop before clicking WRITE. Again, nothing happened.
04/09/06, 01:44pm I go to the Import Extensions page in the extension manager and upload the file I downloaded a few minutes ago. I get a message telling me it was successful. An examination of the server files in my FTP utility indicates that this is in fact the case. Before going any further, I use Dreamweaver to sync the typoconf directory (where the configuration and extension files are kept) with my laptop.
04/09/06, 01:58pm Now it's time to update the PHP code generated by the kickstarter. As before, the book is long on what to do and short on why. It tells me to delete two files. One appears to deal with multiple-language support and the other with editing data in the new table. Neither makes sense for a visitor counter.
04/09/06, 02:04pm The next step is to edit the tca.php file, which describes the field we added to the database. The first thing is to increase the maximum field width to 10 so that it can show more digits. There is also a range element not described in the book which probably limits the number to a value between 10 and 1000. I change it to a lower limit of 0 and delete the upper limit.
04/09/06, 02:08pm Next the book says to open the PHP class file in the pi1 directory. I note that the kickstarter inserts a copyright notice with my name an EMAIL, but with a date of 2004.
04/09/06, 02:13pm The book discusses what should be put in the main() function but it is nothing like what is already there. The code in the function appears to display database fields depending on whether an incoming configuration value specifies a single view or a list view. I decide to install the plugin and put it on the main page so I can see what's happening as I make changes.
04/09/06, 02:20pm I get Permission Denied when I try to upload my changes to the plugin. I create a file called IGNOREME.txt and try moving it in and out of various directories. Only the directories for the installed plugins are protected, but I cannot find out why.
04/09/06, 03:01pm When Typo3 creates a file, it's assigned to the user under which PHP is running, rather than the web site FTP user. I have to figure out how to fix this. A Google search for help gives me several useful hits, all of which take me to a page that tells me the page I want is no longer available. I try the cached copy of one of them, but it's not in the cache either.
04/09/06, 03:33pm There are some configuration parameters that may help. The question is, how do I test them without creating a bunch of undeletable files? I set the file and folder creation masks to 0666 and 0777 respectively, which makes me very nervous, as it means the files are universally writable. I try specifying a group name. The extension uploads correctly and the files and folders are modifiable, but the group change fails.
04/09/06, 04:02pm There appears to be no way around this in my current environment, so I give up and leave the permissions set for full access. I also decide that four hours is all I want to spend reading a chapter called A Visitor Counter in 20 Minutes.
04/09/06, 04:32pm While looking at data types, I believe I have finally found the function parsefunc that replaces constants in the text. All I need to do is look it up in the book.
04/09/06, 05:14pm The book has no usable index, so to find out what a function does, you more or less have to search every page until you find it. Plan to add the author of the book to my Terminal Cancer List. If Hillary Clinton, Rod Blagojevich, and Russ Feingold are all killed in mysterious circumstances, then you know I have less than six months to live and the guy who wrote this book has only a few weeks.
04/09/06, 05:21pm

Here is the code in the master template. In this case NMPDR.Version is a constant defined in the Constants section and contains the NMPDR version number. The following code replaces every occurrence of ###VERSION### in the content with the current version number as defined in the constants.

	constants.VERSION = {$NMPDR.Version}
	page = PAGE 
	page {
	  stylesheet = fileadmin/NMPDR.css
	  20 = CONTENT
	  20.table = tt_content
	  20.select {
	    pidInList = this
	     orderby = sorting
        where = colPos=0
	 }
	 20.parsefunc {
	    constants = 1
	 }
	}

The first line tells the script that VERSION will be used as a marker in the text. The next two lines state that we're building a page. We then define the style sheet to be fileadmin/NMPDR.css. The next three lines tell us that we want to use page content entered by the authors. The select block (four lines) states that we want the content from this page (pidInList = this), in the proper order (orderby = sorting), for the normal column (colPos = 0).

The parsefunc tells the script to parse all the text we've stuffed into element 20, and to use the defined constants (constants = 1).

04/09/06, 05:42pm There is a similar parsefunc capability for processing links. It is of course the links that are causing the six kinds of hell in the original site. I will start to investigate after a short rest.
04/09/06, 07:18pm The makelink feature seems to be for creating links from raw URLs in the text. We need to be able to change the URLs inside links to point to the correct place. I decide instead to concentrate on creating the banner section and the menus. The banner needs to be editable in a fairly straightforward manner. This means the ideal would be to make it a content element that can be re-used on all pages. I begin by creating a dummy page that is marked as hidden and flagged for exclusion from the site search facility.
04/09/06, 07:51pm Updated the template with a CONTENT item that asks for content on the new, hidden page before content from the current page. The hidden text does not appear, however.
04/09/06, 07:58pm While I'm at it, I decide to examine the operation of the stylesheet property for the PAGE type. I want to set this to a URL, but if I do that it doesn't show up. I find information on the Typo3 web site that states the value of the stylesheet must be a resource, not a URL. Resources must all be in the fileadmin directory.
04/09/06, 08:08pm It looks like this page is the place to go for information on TypoScript. I find that the PAGE object has a headerData property that can be used to add tags to the page header. The data type is CARRAY, so the next step is to find out what the heck a CARRAY is. Because I enjoy pain, I verify that the book doesn't have an index entry for CARRAY.
04/09/06, 08:13pm The documentation says that CARRAY is an unordered list of cObjects. I'm going to try creating a CARRAY with a single TEXT object that has the raw HTML I want in it.
04/09/06, 08:36pm

Okay, a CARRAY is actually a COA object. Here is the code that inserts the stylesheet link into each page.

	  headerData = COA
	  headerData {
	     10 = HTML
	     10.value = <link rel="stylesheet" type="text/css" href="{$NMPDR.URL}/fileadmin/{$NMPDR.Style}" />
	  }

This occurs inside the page block. The COA type defines an array. The array has a single element named 10 that is the raw HTML for the stylesheet link. I used constants for both the name of the style sheet and the base URL. If I have a lower-level template, all it needs in order to use a different style sheet is change NMPDR.style in the constants section to the name of the new sheet. This is an excellent example of how powerful Typo3 can be if you have a great deal of time and luck at your disposal. Along the way, I discovered this page which I believe will prove useful.

04/09/06, 08:47pm I now believe my orignal interpretation of the use of numbers was incomplete. In any object, text values (headerData, title) label properties. Number values label list elements. I still can't get the banner to appear, however.
04/09/06, 09:02pm ACK! The substitution of constants does not occur inside elements, only in open text. I am going to have to figure out makelinks after all.
04/09/06, 09:11pm Okay, it appears that in fact the solution is to use custom tags. These are defined by the tags object, and are part of the whole parsefunc thing. I will create a tag that generates an absolute link to a page on the site, and another that generates an absolute link to the external site that has the genetic database in it. It is the tendency of these two sites to move around that is the reason for all this trouble.
04/09/06, 09:19pm I decide I must have been completely mad to download the new version of Typo3 instead of an older, more stable version. Of course, when I go back to the Typo3 web site I can't find a link to a download for an older, more stable version.
04/09/06, 09:23pm Do a search on the Typo3 web site for the pidInList parameter and discover that it won't allow you to show hidden pages. I need some other way of creating a hidden content element. (Note that I still haven't started on the tags thing.)
04/09/06, 10:04pm Create a visible page called Banner and mark it so that it is not indexed and will not be in the menu. I tell the master template to include text items from this page. I set the sort value so that the banner element will sort first. I appears, but at the bottom of the page.
04/09/06, 10:46pm

We have ignition! The following fragment puts the banner at the top.

	constants.VERSION = {$NMPDR.Version}
	constants.SITE = {$NMPDR.URL}
	constants.SPROUT = {$NMPDR.Sprout}
	page = PAGE 
	page {
	  headerData = COA
	  headerData {
	    10 = HTML
	    10.value = <link rel="stylesheet" type="text/css" href="{$NMPDR.URL}/fileadmin/{$NMPDR.Style}" />
	  }
	  20 = CONTENT
	  20.table = tt_content
	  20.select {
	    pidInList = this,3
	    orderBy = sorting
	    colPos = 0
	  }
	  20.parsefunc {
	    constants = 1
	  }
	}

In order to make this work, I had to manually edit the database to set the sorting value for the banner element to 0. There has got to be a better way to do that. In any case, the pidInList tells the script to take all content elements from page 3 (the banner page) plus the current page. The next step is to create the image map used for the banner on the main site.

04/09/06, 11:33pm Trying several ways to rebuild the banner. Ultimately I decide that the method most consistent with the philosophy of Typo3 is to split the banner into pieces and load each one into a table cell.
04/10/06, 12:01am Okay, so that was a huge mistake. I begin research the possibility of doing this with an extension.
04/10/06, 12:36am I think the actual answer is to do it with the custom tags I was planning before. First, however, I need to create dummy page holders for the five pages linked from the banner. I can use the alias feature so that the pages can be accessed by name instead of ID number. I start with Campylobacter, so that I can see if this will work before I put too much effort into it.
04/10/06, 01:11am Another bust. The custom tag stuff is too limited. Time for another nap.
04/10/06, 11:11am After the first full night's sleep since last Wednesday, I decide that maybe Typo3 is not the right tool for this job.