Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

Configuring Mint for Textpattern

Shaun Inman
Mint/Pepper Developer
Posted on Jan 28, '07 at 02:11 am

This howto was originally contributed by ramanan

Setting up Mint for Textpattern is fairly straight forward. The first part of the Mint install instructions involves filling in information in Mint’s configuration file. You can grab this information from your Textpattern configuration file. The configuration data for Textpattern is stored in the config.php file located in your textpattern folder. This file contains values for 7 variables, but we need only concern ourselves with the first four, which are:

$txpcfg['db'] = 'DB_NAME';
$txpcfg['user'] = 'DB_LOGIN';
$txpcfg['pass'] = 'DB_PASSWORD';
$txpcfg['host'] = 'DB_HOST';

This information is all you need to configure Mint. Mint’s configuration file is located in the config folder of your Mint install; it is called db.php. You will need to open it and set the following values using the information from your Textpattern configuration file. You can see how I have matched the values from the two files. (Note that I am assuming you don’t want to change the database table prefix. You may want to do this if you have two copies of Mint running in the same database.)

$Mint = new Mint (array
(
    'server'    => 'DB_HOST',
    'username'  => 'DB_LOGIN',
    'password'  => 'DB_PASSWORD',
    'database'  => 'DB_NAME',
    'tblPrefix' => 'mint_'
));

Now that your mint configuration file is ready, you can upload the folder to your web site as per the instructions. Browsing to this folder should complete the install process.

The last step that remains is adding the JavaScript Mint needs to run to the pages you want statistics logged for. If you want all pages generated by Textpattern to log stats, then the simplest way to do things is to add the following line to your index.php file. The end of the file is reproduced below (as of 4.0.1):

...  
include $txpcfg['txpath'].'/publish.php';

// THIS IS THE NEW LINE WE ADD
@include_once($_SERVER["DOCUMENT_ROOT"]."/mint/config/auto.php"); 

textpattern();

This will insert the JavaScript in to every page on your site. (Here we have assumed that your Mint directory and your Textpattern web site are located in the root folder of your web server.)

(Alternatively, if you have a form template that generates your HTML head sections for all your pages, you can just include the javascript yourself in this template. In that case, include this line of code: <script src="/mint/?js" type="text/javascript"></script> somewhere in that template.)

Thanks for posting this. It worked perfectly on 4.0.6.

alanb
Minted
Posted on Mar 22, '11 at 07:04 pm

I set Mint up with it’s own db.

If I read this post correctly then it’s setting up Mint in the same db as TXP. There’s no hidden advantage I’m missing here that comes from doing that is there?

ramanan
Minted
Posted on Aug 17, '11 at 09:52 am

No. I just wanted to make the set up instructions as easy as possible. You should be able to put Mint wherever you like.

You must be logged in to reply. Login above or create an account