]> git.mxchange.org Git - friendica.git/commitdiff
template: set smarty3 as default template engine in theme info array.
authorFabrixxm <fabrix.xm@gmail.com>
Thu, 28 Mar 2013 08:07:51 +0000 (09:07 +0100)
committerFabrixxm <fabrix.xm@gmail.com>
Tue, 23 Apr 2013 07:35:31 +0000 (03:35 -0400)
remove commented code from get_markup_template.
add check for $root/$filename in get_template_file.

boot.php
include/text.php

index 477b8331c00644b11909fcb0c150d932ef74eaf3..94b9fdc8f78b7fb922c1715c4f905c1f0c813543 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -383,7 +383,7 @@ if(! class_exists('App')) {
                        'force_max_items' => 0,
                        'thread_allow' => true,
                        'stylesheet' => '',
-                       'template_engine' => 'internal',
+                       'template_engine' => 'smarty3',
                );
                
                // array of registered template engines ('name'=>'class name')
@@ -755,7 +755,6 @@ if(! class_exists('App')) {
                 * @return object Template Engine instance
                 */
                function template_engine($name = ''){
-                       
                        if ($name!=="") {
                                $template_engine = $name;
                        } else {
@@ -764,6 +763,7 @@ if(! class_exists('App')) {
                                        $template_engine = $this->theme['template_engine'];
                                }
                        }
+                       
                        if (isset($this->template_engines[$template_engine])){
                                if(isset($this->template_engine_instance[$template_engine])){
                                        return $this->template_engine_instance[$template_engine];
@@ -783,7 +783,8 @@ if(! class_exists('App')) {
                }
 
                function set_template_engine($engine = 'smarty3') {
-
+                       $this->theme['template_engine'] = $engine;
+                       /*
                        $this->theme['template_engine'] = 'smarty3';
 
                        switch($engine) {
@@ -794,6 +795,7 @@ if(! class_exists('App')) {
                                default:
                                        break;
                        }
+                       */
                }
 
                function get_template_ldelim($engine = 'smarty3') {
index 628b4fc2daaa4be33ba7997863275b888d1ad6d1..72a2e1c37252cc0d5930286629a1b575476d3bb3 100644 (file)
@@ -570,28 +570,6 @@ function get_markup_template($s, $root = '') {
        $a->save_timestamp($stamp1, "file");
        
        return $template;
-       /*
-
-       if($a->theme['template_engine'] === 'smarty3') {
-               $template_file = get_template_file($a, 'smarty3/' . $s, $root);
-
-               $template = new FriendicaSmarty();
-               $template->filename = $template_file;
-               $a->save_timestamp($stamp1, "rendering");
-
-               return $template;
-       }
-       else {
-               $template_file = get_template_file($a, $s, $root);
-               $a->save_timestamp($stamp1, "rendering");
-
-               $stamp1 = microtime(true);
-               $content = file_get_contents($template_file);
-               $a->save_timestamp($stamp1, "file");
-               return $content;
-
-       }
-        */
 }}
 
 if(! function_exists("get_template_file")) {
@@ -613,6 +591,8 @@ function get_template_file($a, $filename, $root = '') {
                $template_file = "{$root}view/theme/$theme/$filename";
        elseif (x($a->theme_info,"extends") && file_exists("{$root}view/theme/{$a->theme_info["extends"]}/$filename"))
                $template_file = "{$root}view/theme/{$a->theme_info["extends"]}/$filename";
+       elseif (file_exists("{$root}/$filename"))
+               $template_file = "{$root}/$filename";
        else
                $template_file = "{$root}view/$filename";