Go to content
pfactor site logo Picture of Mooney in flight (top logo)

RSS Feed


Going Live With Textpattern

posted Jan 29, 2006

This website has a new look, but even more has changed under the covers. We’re now using Textpattern as the content management system (CMS) for this site. While porting over, Nancy and I gave the site a new set of colors and added the new tabbed-navigation controls at the top of the page.

After finishing the work to port the original version of this website to Textpattern (see Porting to Textpattern for details), there were just a few things that I really needed to clean up before actually going live with the site.

There are more improvements planned over time, so stay tuned. Please drop us a note and let us know what you think of the new look, or if you find any problems we should know about.

Fixing Up the “Page Not Found” Message

Textpattern 404 error

The first thing I really needed to do was to fix up the “404” error page that textpattern shows when a page is not found. A screenshot of the default Textpattern “page not found” message is shown here. Since it’s a default page for every Textpattern install, obviously it does not have the same look as the main site. Part of porting to Textpattern meant that all the URLs for the original site content are different. Search engines and old bookmarks are likely to still be pointing the old locations. I will try to address some of this by doing some Apache redirection when old URLs are requested, but I’m sure some 404 pages are still going to happen and I wanted something a little more polished than the default page.

This was actually quite easy to fix. All I had to do was create a new section that I called siteerror and put a static article in that section, and tagged it with the keyword error_default (of course I could have used any keyword, but using the same keyword as the page that was going to refer to the article seemed simplest to me). Next I changed the error_default page to display the standard site layout stuff and then the static article from that section (which I access using the keywords attribute to the txp:article tag).

Contact Page

I wanted to make sure people had a way to let me know about any problems they found with the new Textpattern-driven site. Posting a mailto link is just asking for spam, so I wanted a real contact form to use in Textpattern. I didn’t expect this to be a built-in feature of Textpattern, but I did expect to find a standard plugin that was well-used, secure and maintained.

Textpattern Contact Plugin

Open Source Development Works!

When I first started porting to Textpattern in December of 2005 the plugin I was seeking did not really exist. A Textpattern developer named Zem had created a plugin called zem_contact but I think he got busy with other development work and was no longer able to continue maintaining the plugin. Several threads in the Plugins section of the Textpattern support forum were full of bug reports and enhancements requests regarding zem_contact, but Zem wasn’t responding to them.

Finally this thread got the ball rolling and a couple of other folks from the Textpattern forum took the ball and ran with it and the result was zem_contact reborn. This is a great example of open-source software development at its best. The original developer couldn’t maintain the code, but it was possible for anyone else to pick up the pieces and move them forward. Bravo to all those who took up the challenge and brought this useful plugin back to life, and thanks so much to Zem for making the original version of this plugin available under an open source license.

See the sidebar for an interesting story behind the zem_contact plugin, that’s used for the contact form. Here’s all I needed to do to make it work.

  1. Download, install and activate the plugin
  2. I wanted the contact form to be accessed at http://pfactor.com/contact, so I just created a section called “contact”, made a page called pf-contact-page which showed the static article for that section.
  3. Created the static article for the “contact” section containing this tag: <txp:zem_contact to="my-actual-address@example.com" />. You can see that page for yourself here.

That was it. It worked right away and I was able to send a test message immediately using just the basic settings of the plugin. Very nice! I also verified that my real email address wasn’t shown anywhere in the HTML source, and that the form was protected against the usual types of attacks made against contact forms.

After getting the basic implementation working, I did a little CSS styling to make the form look the way I wanted, and used some of the optional tags and attributes. Here’s what I ended up with:

 <txp:zem_contact to="my-actual-address@example.com" >

<p>We'd love to hear from you... </p> <p><txp:zem_contact_text required="yes" label="Name:" size="40" /></br> <txp:zem_contact_email required="yes" label="E-Mail:" size="40" /></br> <txp:zem_contact_textarea required="yes" label="Message:" max="5000" /></br> <txp:zem_contact_serverinfo name="REMOTE_ADDR" label="IP" /> <txp:zem_contact_serverinfo name="REMOTE_HOST" label="Hostname" break="" /> <txp:zem_contact_serverinfo name="HTTP_USER_AGENT" label="Browser" /> <txp:zem_contact_serverinfo name="HTTP_REFERER" label="Refered by" /></p> <p><txp:zem_contact_submit label="Send" /></p> </txp:zem_contact>

Add your comment     Comments: 1

Wow I really like your new look. I am using Textpattern too as CMS for my site. I enjoyed it.

#1 Foronda - 12/01/2011 03:45 AM

(required, never displayed)

(optional, displayed)

You can use Textile to
format your comment.

*bold text* » bold text
_italics_   » italics
@code@      » code
a "link":http://xyz.com » a link

Comments will be made public. You can send a private message via the contact form

© 2000-2019 Phil Verghese, all rights reserved.
XHTML | CSS | RSS | Powered by Textpattern | Hosting by Dreamhost