Quote from: OpenGeek at Dec 02, 2007, 07:26 PM
No, base_path will never be an empty string; it should always mirror MODX_BASE_PATH which is a constant.
I certainly would have thought so, but when I moved veriword.php to my snippet directory and put this code at the top:
require "../../../manager/includes/config.inc.php"; // required for $modx to work
$spformPath = "assets/snippets/spform/";
require $modx->config['base_path'].$spformPath."spfconfig.cfg.php";
The first require succeeds but the second fails. When I tested $modx->config[’base_path’] there, it was definitely an empty string. Maybe there’s something I’m missing (there often is

).
Maybe there’s something wrong with my test of $modx->config[’base_path’]. I couldn’t use any output there, so I put this code just below the code above:
if (strlen($modx->config[’base_path’]) >= 1) {
exit;
}
The file exits and no image is produced unless I change ">=1" to "<1", then it runs fine.
Using MODX_BASE_PATH gives the same result.
The veriword file is accessed by a URL in an img tag.
Looking at config.inc.php, it appears that $base_path could be set to "" and MODX_BASE_PATH is then set to $base_path:
$base_path= $pth . (substr($pth, -1) != "/" && substr($pth, -1) != "\\" ? "/" : "");
if (!defined('MODX_BASE_PATH')) define('MODX_BASE_PATH', $base_path);
I’m sure this could never happen in a regular snippet but it looks like the way this code is accessed via an img tag, makes the first part of the $base_path conditional false.
Bob