Switch the 'modify' code of admin/field.php to use templates
[bugdar.git] / docs / cache_templates.php
1 <?php
2
3 // takes all the templates in Bugdar and moves them to the database
4 // SVN $Id$
5
6 chdir('..');
7 require_once('./global.php');
8
9 $files = BSFunctions::scan_directory('templates');
10
11 $db->query("TRUNCATE TABLE " . TABLE_PREFIX . "template");
12
13 foreach ($files AS $path => $bits)
14 {
15 foreach ($bits AS $file)
16 {
17 if (BSFunctions::fetch_extension($file) == 'tpl')
18 {
19 $db->query("INSERT INTO " . TABLE_PREFIX . "template (filename, template, timestamp) VALUES ('$path" . substr($file, 0, strlen($file) - 4) . "', '" . $db->escape_string($template->_parse(file_get_contents("templates/$path$file"))) . "', " . time() . ")");
20 }
21 }
22 }
23
24 ?>