External Qdig Settings
Starting with Qdig 1.2.6, you can pass settings to Qdig by including a qdig_settings() function in your PHP wrapper script. Current Qdig releases also are capable of using external language settings.
Using external settings allows you to
- Share a single copy of Qdig among many galleries.
- Upgrade quickly and easily.
- Experiment without affecting an existing gallery.
- Keep some galleries private (chrooted).
The qdig_settings() Function
All you need to do to have external settings is to place your settings in a qdig_settings() function in a script that calls the Qdig script with an include() statement. Settings you put in the function will override the ones in the Qdig script.
The qdig_settings() function is demonstrated in some advanced examples on the page about embedding qdig galleries. You can also have a settings-only wrapper script, which is what is described here.
The Settings-Only Wrapper Script
Example One - Enable Diag Messages
Here is a very basic example of a settings-only wrapper script that simply enables Diagnostic Messages for your stand-alone gallery:
<?php
function qdig_settings($version)
{
global $header, $diag_messages;
$header['force_ena'] = TRUE;
$diag_messages = TRUE;
} // end function qdig_settings()
include("index.php");
?>
The first line in the function declares the $header and $diag_messages variables global. If you forget to declare a variable global (which is easy to do) the setting(s) for that variable will not be recognized by the Qdig script.
Next are the settings. You'll want to set $header['force_ena'] to TRUE so your gallery will have HTML headers and footers. The other setting enables Diagnostic Messages.
The first line in the settings-only script should start with (<?php) without any leading blank lines or spaces. The last line in the script (?>) is optional.
Example Two - More Diagnostic Settings
Here is a more advanced diagnostic wrapper. This one is appropriate to use for Qdig development because it allows you to jump directly to the script and it sets verbose error reporting:
<?php
function qdig_settings($version)
{
global $site_lnk_title, $site_lnk_url, $header,
$diag_messages, $orig_err_rep_level;
if (!empty($_SERVER['QUERY_STRING'])) {
$q_s = '?'.$_SERVER['QUERY_STRING'];
}
$site_lnk_title = 'index.php';
$site_lnk_url = "./index.php$q_s";
$header['force_ena'] = TRUE;
$diag_messages = TRUE;
$orig_err_rep_level = error_reporting(E_ALL);
} // end function qdig_settings()
include("index.php");
?>
Example Three - Some Qdig Display Settings
This example configures Qdig to have big thumbnail images and lots of resampled sizes to choose from.
<?php
function qdig_settings($version)
{
global $copyright, $header, $cnvrt_thmb, $ctrl_bar, $lwr_nav, $disp_size;
$copyright['txt'] = 'Images copyright ©
2003, 2004, 2005 Hagan Fox. All rights reserved.';
$header['force_ena'] = TRUE;
$cnvrt_thmb['size'] = 70;
$cnvrt_thmb['prefix'] = "thm{$cnvrt_thmb['size']}_";
$ctrl_bar['def_size'] = TRUE;
$lwr_nav['tmp_size'] = TRUE;
$disp_size['0'] = TRUE;
$disp_size['1'] = TRUE;
$disp_size['2'] = TRUE;
$disp_size['3'] = FALSE;
$disp_size['4'] = TRUE;
} // end function qdig_settings()
include("index.php");
?>