Textpattern: Step 1.1 - Modify

Change the name of the textpattern directory

Before we get too deep into things, here is a little tidbit of knowledge that may come up later, but let’s deal with it now. If this is a little too much too soon, just skip to the next step.

The Textpattern directory is called “textpattern” by default. What if you were creating a site for a client and typing www.theirdomain.com/textpattern to access the administration system seemed counterintuitive. You could call the directory something else completely. But you need to change a few files to accomplish this.

Let’s say we want to rename the directory to admin. There are a few files that need to change.

  1. index.php
  2. admin/config.php
  3. admin/publish/taghandlers.php

Let’s take a look inside index.php. This is what it would have looked like before revision 461 from the Textpattern repository:

<?php
$here = dirname(<i>FILE</i>);
include './textpattern/config.php';
include $txpcfg['txpath'].'/publish.php';
textpattern();
?>

Then there is this code for those who are using a revision after 461:

<?php
// Make sure we display all errors that occur during initialization
error_reporting(E_ALL);
ini_set("display_errors","1");
// Use buffering to ensure bogus whitespace in config.php is ignored
ob_start();
$here = dirname(<i>FILE</i>);
include './textpattern/config.php';
ob_end_clean();
include $txpcfg['txpath'].'/publish.php';
textpattern();
?>

Look for the code that looks like this:

include './textpattern/config.php';

Then replace it with this:

include './admin/config.php';

Now open the admin/config.php file and change this:

$txpcfg['txpath'] = '/path_to_site/textpattern';

to this:

$txpcfg['txpath'] = '/path_to_site/admin';

If you stopped there, you would find that your site had no css styles. Textpattern needs to know that path for including css files from the database. So, open the admin/publish/taghandlers.php file and change these lines:

if ($n) return hu.'textpattern/css.php?n='.$n;
return hu.'textpattern/css.php?s='.$s;

to these lines:

if ($n) return hu.'admin/css.php?n='.$n;
return hu.'admin/css.php?s='.$s;

comments | date posted posted Friday July 8, 2005

The Builders Collective

The Builders Collective is about building community and building a repository of ideas, techniques and code for building a better world wide web.

Articles Archive > View Recent