Commit 6fa84f9d authored by Penny Leach's avatar Penny Leach
Browse files

fixed some weird stuff in template parser

parent 4bf4a6eb
......@@ -30,10 +30,9 @@ function template_parse($templatename) {
$t = array();
$template = template_locate($templatename);
$template = $template['fragment']; // we don't care about css or thumbnails right now
$fragment = file_get_contents($template);
$template = template_locate($templatename, false);
$fragment = file_get_contents($template['fragment']);
preg_match_all('/(.*?)\{\{(.*?)\}\}/xms', $fragment, $matches, PREG_SET_ORDER);
......@@ -59,7 +58,8 @@ function template_parse($templatename) {
$t[] = $temp;
return $t;
$template['parseddata'] = $t;
return $template;
}
function template_parse_block($blockstr) {
......@@ -86,7 +86,7 @@ function template_parse_block($blockstr) {
}
function template_locate($templatename) {
function template_locate($templatename, $fetchdb=true) {
// check dataroot first for custom templates
$templatedir = 'templates/' . $templatename . '/';
......@@ -108,6 +108,10 @@ function template_locate($templatename) {
break;
}
}
$dbstuff = get_record('template', 'name', $templatename);
$template['cacheddata'] = unserialize($dbstuff->cacheddata);
$template['category'] = $dbstuff->category;
$template['location'] = get_config('datarootroot') . 'templates/' . $templatename . '/';
return $template;
}
......@@ -122,6 +126,10 @@ function template_locate($templatename) {
break;
}
}
$dbstuff = get_record('template', 'name', $templatename);
$template['cacheddata'] = unserialize($dbstuff->cacheddata);
$template['category'] = $dbstuff->category;
$template['location'] = get_config('libroot') . 'templates/' . $templatename . '/';
return $template;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment