My Textpattern Install

   10 July 2004, lunch time

[update: This install is basically not worth using anymore, as the latest version of Textpattern finally does a lot of the stuff this fork was released to do. If you are new to Textpattern, I recommend you download the official version.]

I’ve been asked a few times how I went about modifying Textpattern to end up with the URLs I have. I was planning on writing it all up in a tutorial of some sort, but I have been lazy.

So, for the curious out there, here is my textpattern directory all zipped up. Inside is a hidden .htaccess file, which you will have to move to the folder below the textpattern folder (the one where the index.php file is located.) You will need to supply your own config.php file, since I have erased mine. (Least I hope I remembered to.) You should replace your textpattern directory with mine if you are interested in using my install.

I use modrewrites to get the URLs I want, so you don’t need any other php files besides index.php—ie you don’t need to make those dummy files for each of your sections.

There is a file called __update.php that will update your database so that every single entry has a URL Title. URL titles are generated automatically in this install if they are not supplied. (They would simply match the title supplied.) You need to run this file, since URL titles need to exist if you are using URLs without ID’s supplied.

I think that would be all you need to know to try things out. Of course, back up your stuff before mucking around, though I think this should be a relatively safe endeavour.



  1. I don’t think I used the variable $pfr when I made my URLs, so your site has to be at the root of your web server. If you are having problems with this install, that might be why.

  2. Can you double check to make sure this is correct?

  3. I am pretty sure it is. Is there a problem?

  4. hey i saw that the txp version that is in this zip is 1.19, as i’m running the 1.0 latest version, is there any code i need to replace in the any of the txp files?

  5. There very well may be, but I really don’t know what. I’ll probably wait for the final 1.0 version before making my changes again.

  6. You lazy bum :).

    Seriously, I think a tutorial on how you hacked the URL’s would be mroe usefull than this, but if you don’t have time I can udnerstand.

  7. As I said, I was planning on waiting till 1.0 is actually out before writing up a tutorial. To be brief, the changes I made are as follows.

    I changed the code that looks up articles so that the $id variable you supply can be a string. In this case it will look up the article by its URL title. It can still look up articles by numeric ID so it will not break old URLs. The article save function was modified to generate a URL title if one is not supplied. In this way, every article will have a URL title. I wrote a script that created URL titles for older posts that did not have them. Finally I modified all the code that generated a URL so that it did not include the article ID, and did include the URL title. This meant changing code in the RSS and ATOM php files, and some of the functions in tag handlers. I’m fairly sure this is all you need to do to get clean URLs like mine.

  8. Ramanan, you’re the man! (Damn it. That rhymed.) I finally have ‘Clean’ URLs working on my 1& TextPattern site… and I owe it to you. Thank you for posting your code!

Don't be shy, you can comment too!

Some things to keep in mind: You can style comments using Textile. In particular, *text* will get turned into text and _text_ will get turned into text. You can post a link using the command "linktext":link, so something like "google": will get turned in to google. I may erase off-topic comments, or edit poorly formatted comments; I do this very rarely.