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
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
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.
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.
- Download, install and activate the plugin
- 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-pagewhich showed the static article for that section.
- Created the static article for the “contact” section containing this tag:
<txp:zem_contact to="firstname.lastname@example.org" />. 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="email@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>