File modules/template_engine/TemplateCompiler.php
Last commit: Wed Nov 17 23:22:19 2021 +0100 Jan Dankert Refactoring: Using a template context for templates instead of the HTTP-Request-Data
1 <?php 2 3 header('Content-Type: text/plain'); 4 5 /** 6 * Using the Component classes and generating a XSD-File. 7 */ 8 error_reporting(E_ALL); 9 ini_set('display_errors', 1); 10 ini_set('display_startup_errors', 1); 11 12 use cms\base\Startup; 13 use template_engine\AppInfo; 14 use template_engine\engine\TemplateContext; 15 use template_engine\engine\TemplateEngine; 16 use util\FileUtils; 17 18 Startup::initialize(); 19 20 AppInfo::$styleClassPrefix = Startup::CSS_PREFIX; 21 22 $searchDir = __DIR__ . '/../../modules/cms/ui/themes/default/html/views'; 23 24 25 echo "Searching in $searchDir\n"; 26 27 $count = 0; 28 29 30 foreach(FileUtils::readDir( $searchDir ) as $action ) 31 { 32 if ( !is_dir($searchDir.'/'.$action ) ) 33 continue; 34 35 echo "Action: $action\n"; 36 37 foreach(FileUtils::readDir( $searchDir.'/'.$action ) as $file ) 38 { 39 if ( substr($file,-12 ) == '.tpl.src.xml' ) 40 { 41 $count++; 42 $method = substr($file, 0,-12 ); 43 echo "\tMethod $method\n"; 44 45 $templateFile = $searchDir.'/'.$action.'/'.$file; 46 $outFile = $searchDir.'/'.$action.'/'.$method.'.php'; 47 48 $engine = new TemplateEngine(); 49 50 // We are creating a fake request, because the template compiler needs to know 51 // the action and subaction in which it will be executed. 52 $context = new TemplateContext(); 53 $context->action = $action; 54 $context->method = $method; 55 $engine->context = $context; 56 57 echo "\t\tcompiling $templateFile\n\t\t to $outFile\n"; 58 59 $engine->compile( $templateFile,$outFile ); 60 } 61 } 62 } 63 echo "\nSummary: Compiled $count files.\n"; 64
Downloadmodules/template_engine/TemplateCompiler.php
History Wed, 17 Nov 2021 23:22:19 +0100 Jan Dankert Refactoring: Using a template context for templates instead of the HTTP-Request-Data Wed, 14 Oct 2020 22:36:29 +0200 Jan Dankert Refactoring: Fixed the namespace in component classes, now the are able to be load by the standard autoloader. Wed, 14 Oct 2020 22:10:49 +0200 Jan Dankert Refactoring: Renamed component class files, so that the filename correlates with the class names (as in all other classes) Sat, 10 Oct 2020 01:29:41 +0200 Jan Dankert Refactoring: Only using CSS classes with the 'or-'-prefix. Sat, 26 Sep 2020 12:20:43 +0200 Jan Dankert Refactoring: No global variables like $SESS any more. All constants are capsulated by classes. Sat, 26 Sep 2020 04:03:53 +0200 Jan Dankert Refactoring: read language keys with a class. Sat, 26 Sep 2020 01:41:20 +0200 Jan Dankert Refactoring: Removing old require.php files. With class autoloading, they are not necessary any more. Fri, 21 Aug 2020 00:22:13 +0200 Jan Dankert Refactoring: Collect all frontend compiler scripts in update.php. Compiling of CSS and JS was extracted to a new TemplateCompiler. JS and CSS is now collected in a new openrat.[min.][js|css]. Sat, 11 Jul 2020 00:49:57 +0200 Jan Dankert Fix: if-statements with equals-attribute, the attribute is considered as a string. Sun, 23 Feb 2020 05:17:22 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, last part 3. Sun, 23 Feb 2020 04:49:34 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 2. Sat, 22 Feb 2020 23:58:02 +0100 Jan Dankert Refactoring: Namespacing for module 'util'. Sat, 22 Feb 2020 22:23:01 +0100 Jan Dankert Refactoring: Enable Autoloading, Fix namespace structure. Sat, 22 Feb 2020 01:58:20 +0100 Jan Dankert New: Autoloading of classes in all modules. Sat, 22 Feb 2020 00:46:59 +0100 Jan Dankert Refactoring: Renaming template-engine to template_engine because '-' is no valid namespace char.