define()
statements. These can be declared on a conditional basis (inside an if
statement in the PHP code). They must be declared before including Sparse.php. For
example, to turn off Ajax and set the temporary directory, you'd do
this:<?php
define('SPARSE_NO_AJAX', true);
define('SPARSE_TEMP_DIR', 'c:\windows\temp\');
include('Sparse.php');
SparseThisPage('myUsername', 'myPassword');
?>
Option | Value | Description |
---|---|---|
SPARSE_NOCACHE | true | Disable caching of the Sparse code (see below). |
SPARSE_NOWARN | true | Disables the warning log (see below). |
SPARSE_NO_AJAX | true | Disables Ajax functionality entirely. |
SPARSE_FILE_DIR | string | The web address of your page. Only used in Ajax functionality. If you see your Ajax pages failing, it may be because you haven't set this properly. You only really need to set it if your server doesn't use $_SERVER['DOCUMENT_ROOT'] and $_SERVER['HTTP_HOST'] normally. Don't forget the trailing /. |
SPARSE_TEMP_DIR | string | By default, Sparse will store its cached code and warning logs in /tmp/ . Use this if you want them to be stored in another directory. Don't forget the trailing /. |
SPARSE_LOG_FILE | string | By default, Sparse will store the warning log in SPARSE_TEMP_DIR/sparse_warning.log. Use this to store it in another file. |
SPARSE_THROBBER | string | URL of an animated throbber image to be used in Ajax functionality. By default, uses Sparse's throbber image. Set it to "none" to disable the throbber entirely. |
SparseThisPage
or SparsePage
is called from). In other words, if the template file itself is
changed, Sparse
will re-parse it. If you want to force Sparse to re-parse the template
(recording new information about your SQL tables), simply modify the
actual file and
save it, or set the SPARSE_NOCACHE option temporarily.For the record, the name of the cache file is the full filepath of the page that calls Sparse, with / and \ replaced by %, followed by ".sparse".
Remember that PHP must have write access to the SPARSE_TEMP_DIR directory!
/tmp/sparse_warning.log
. Again, remember that PHP
must have write access to the warning log.
Previous: Errors | Configuring Sparse | Next: Advanced PHP Usage