My Textpattern Install
10 July 2004, mid-afternoon
[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.
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.
by ramanan on July 13 2004, 12:53 am #
Can you double check to make sure this is correct?
by Ian Gordon on July 16 2004, 1:29 pm #
I am pretty sure it is. Is there a problem?
by ramanan on July 16 2004, 10:44 pm #
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?
by amory on October 4 2004, 1:45 am #
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.
by ramanan on October 10 2004, 1:11 pm #
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.
by SteveC on December 10 2004, 5:24 pm #
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.
by ramanan on December 10 2004, 7:13 pm #
Ramanan, you’re the man! (Damn it. That rhymed.) I finally have ‘Clean’ URLs working on my 1&1.com-hosted TextPattern site… and I owe it to you. Thank you for posting your code!
by Ian Pitts on February 2 2005, 1:51 pm #