Since I store my tpl files inside the
core/templates/ which is out of the web root, it makes this snippet can not take the file, since it fetch from the assets_path folder
<?php
switch ($type) {
case '@FILE':
$path = $modx->getOption('tplPath', $properties, $modx->getOption('assets_path', $properties, MODX_ASSETS_PATH) . 'elements/chunks/');
$key = $path . $source;
if (!isset($_cache['@FILE'])) $_cache['@FILE'] = array();
if (!array_key_exists($key, $_cache['@FILE'])) {
if (file_exists($key)) {
$content = file_get_contents($key);
}
$_cache['@FILE'][$key] = $content;
} else {
$content = $_cache['@FILE'][$key];
}
I have a snippet file, that have an option &root=`core` or &root=`web`.
Perhaps you don’t mind to add this too.