How to set up pjjTextBase?

To use pjjTextBase you need just one line:

  require '/path/to/pjjtextbase.php';

where /path/to/ is, of course, path to a directory, where pjjtextbase.php file was placed.

ptb_ini.php

pjjTextBase comes with some default values, which can be changed in ptb_ini.php file (I believe it is more flexible to change those values outside the script file: when new version of pjjTextBase comes out, you will only have to upload it, whithout any modifications, while your individual settings will remain untouched).

Since version 1.2 they are read sequentially, one by one, which means that you don't have to put all of them into ptb_ini.php file, but only these which are different than default ones.

This settings are as follows:

PTB_DEFAULT_DB_LOCATION
You can use ptb_connect without explicitly giving variable $location; in such case the script will use this setting. Possible values are: G (directory defined by PTB_PATH_DB), L (local directory, ie. the one where the script is placed) or F (take $filename as it is, without $_SERVER['DOCUMENT_ROOT'] dependency, eg. "../authors.csv"). Default value is G.
PTB_PATH_DB
Path to a directory, where data files are kept; of course it makes sense only if PTB_DEFAULT_DB_LOCATION (see above) is set to G, in other cases it's just skipped. Default value is /db.
PTB_FILE_DB_PREFIX
What prefix should database files use to stand out more easily? This is also important if you use link or multi fields. Default value is db_ null (empty string), since you are advised to put all your data files into one directory (described by PTB_PATH_DB)
PTB_NEWLINE
What kind of newline should PTB use? Windows (\r\n), Unix (\n) or Mac (\r)? Default value is \n
PTB_DEFAULT_SECURITY
Should data files have security string? Can be 0 or 1; default is 1.
PTB_SEC_STR
How the first line for secured files should look like? Default value is <?php die('Access denied!');?>
PTB_SHOW_ERRORS
Should the PTB error messages be displayed? Default value is false (during developement certainly it should be set to true).
PTB_BOM
Should all written files (ptb_update, ptb_delete etc.) have BOM (kind of UTF signature; codepage of data depends on the codepage of your webpage)? Default value is false, since UTF-8 files don't really require BOM.
PIPE
If you'd like to use pipe sign somewhere inside a field, you have to use a substitution code for it to avoid confusion with field separator; here you should define this substitution; default is &pipe;. Attention! This substitution is switched off to speed up the script; if you need to use it, you have to uncomment one line in ptb_connect and comment another.

Line that must be uncommented, if you want to use pipe sign:

$record[$recordNo][$fieldnames[$j]] = str_replace(PIPE, '|', $splitLine[$j]);

Line that must be commented, if you want to use pipe sign:

$database[$recordNo][$fieldnames[$j]] = $splitLine[$j];

ptb_ini.php file should be placed in the same directory as pjjtextbase.php.

Predefined constants

There is (since version 1.2 on) one predefined constant, declared in the main file:

PTB_VERSION
number of current script's version (floating point number)