Godbit Textpattern Code

10 comments | Posted: 24 January 06 in Tutorials, by Nathan Smith

This article was originally posted on January 24, 2006. However, since it contains a code package that pertains to how this site is run, I am re-posting it. There have been several changes in Textpattern as of version 4.0.4, so the code bundle has been updated accordingly. This is also the code for the Godbit case study in our upcoming book, Textpattern Solutions.

As promised earlier, this article will be a brief explanation of how Godbit.com runs “under the hood,” so to speak. One of the great things about CSS, XHTML and JavaScript is that they are public facing, meaning if you see something that is cool, it’s pretty easy to reverse engineer and figure out how it’s done. This is also the drawback, because people take it a step further into outright stealing.

On the flip side of that coin are server-side technologies such as PHP or proprietary CMS code. It is often tough to learn how various people’s projects are done, because by the time the code gets to your browser, it has been transformed into straight XHTML. In this case, we’ll be talking about CMS code, but of course it’s from the open-source project Textpattern. Lucky for our readership, my parents taught me to share, and I want your sites to be nice.

Please note that the basics of how to set up and use Textpattern are beyond the scope of this article. Likewise, I am not going to cover all of the syntax since that is done in the Resources + Wiki. All I’m going to do here is provide you with all of the templates that drive Godbit, and let you sort out the rest. I am presupposing that you know how to at least get Textpattern up and running.

There’s really no effective way to show huge chunks of TXP code in the body of a Textpattern article, because it would be tedious, and TXP would try to convert it to XHTML. So, I’ve done the next best thing and made each page template and form into a text file. Since some of the Forms templates are named the same as the Pages (such as default), I have prefixed the files with either F_ or P_ depending on the type. Also note that intermixed is various plugin syntax, as well as PHP from PunBB. I left it unaltered, just in case it proves useful.

In case you are curious, here are the plugins that are used on this website:

Download Code: TXP_Godbit.zip (12kb) – for v4.0.4

Note: The plugins named “rss_” have nothing to do with RSS feeds. The author’s name is Rob S. Sable. Also, rss_admin_db_manager is not essential to the functioning of Godbit’s front-end. That plugin simply allows me to one-click backup the entire site. The JavaScript in the default article form is used for our tutorial code highlighting. Because of a little txp:if_category conditional, the four JS files can be toggled on/off by simply choosing “code” as the 2nd article category. Hopefully these files will be helpful to you. Happy TXP’ing!

Discuss This Topic

  1. 1 matthew Smith

    This is great. It will prove useful for a lot of folks trying to learn TXP. You may consider posting a note to this at the forums or at textpattern resources. Good for you for sharing. :)

  2. 2 Natalie

    Wow, no comments yet? Amazing. You can’t see me but I’m bowing in thanks. And if you were here I’d give ya a big ole’ hug! I learned everything I know about Textpattern from you, Rob and by jumping in and doing it! I recommend the latter, but thank both formers for speeding up the process. ;)

  3. 3 Sencer

    Hi Nathan,

    that’s a very nice idea. :) I am sure many people will appreciate it.


  4. 4 Mark

    Great article. Thanks for posting the files. The more I work with TXP, the more I learn how to boil it down to use fewer page templates by using the power of conditional TXP tags and Forms. I think this is what makes TXP so extraordinary.

    One thing that I’ve always struggled with is how comments work in TXP, so I really appreciate that piece the most. Thanks!

  5. 5 Nathan Smith

    I’m glad you guys are finding it helpful. I know it was an up-hill battle for me when I first started learning Textpattern. There weren’t great resources or the wiki yet, so I learned most everything from Kusor’s Textpattern Manual.

  6. 6 Estrup

    As an absolute newbie into Textpattern, I really appreciate your initiative … Reckon it’ll save me some valuable time. Thanks! Greetings from Denmark!

  7. 7 Roman

    I’m looking for a publishing platform for my church. Can you speak to how well Textpattern would accomodate this? We need more than just articles. We need calendars and image galleries and the like.

    Can anyone give insight to free community publishing platforms that are robust yet easy to use?

    Did I mention free?


  8. 8 Nathan Smith

    Roman: I think it would be tough to find a free calendar / image gallery and CMS all in one. However, you might want to look into the Expression Engine, the core of which is free, and the other add-ons just a small price for upgrading.

  9. 9 John Miller

    I think you could benefit from one of the cms’s that are open source, the one that comes to mind that would basically meet all your requirements would be http://e107.org you can see the versions i have running at http://carolinaglassllc.com and http://marinlouise.com

    good luck in your search.

  10. 10 WD Milner

    Great idea, thanks! Having real life examples can make the learning curve much shallower, or at least faster to negotiate.

    I’ll also take the opportunity to congratulate you on a great looking site.

    To Roman: it can be a bit faunting but if TextPattern seems too limited you could try Joomla or Xaraya. Both offer a wide range of options and flexibility.


Comments closed after 2 weeks.