Firefox 3

How to set up pjjTextBase?

To use pjjTextBase you need just one line:

require $_SERVER['DOCUMENT_ROOT'] . '/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 these values outside the script file: when new version of pjjTextBase comes out, you will only need 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.

These 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 while writing records to a data file? Windows (\r\n), Unix (\n) or Mac (\r)? Default value is \n
— OK, it seems that I went overboard with this one and default setting should be perfect for everybody.
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
This constant was used to describe string that you would substitute for pipe sign, i.e. |, which is used as a field separator and therefore can't be written to a database directly. However, after some consideration I came to conclusion that this approach had been basically wrong and in the next version of pjjTextBase PIPE will be no more used. You are therefore advised to check your input (e.g. from a form) for pipe characters and before you write it down to a database change each of them into entity &#0124;, which is displayed by all modern browsers as a pipe: | No more need to do any tweaking, then.

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)