Auf verschiedenen Gründen habe ich meinen Raspberry auf den aktuellen Stand gebracht. Das heißt alle Updates gemacht und auch Python aktualisiert. bei SmartHomeNG läuft alles. Die SmartVISU auf dem gleichen Raspberry jedoch nicht so recht. Wenn ich eine Seite ladem will zeigt er mir anstatt des grafischen Interfaces den Quellcode im Browserfenster an. Wieso?
Code:
addPath(const_path.'pages/'.$config_pages); if (dirname($request['page']) != '.' && is_dir(const_path.'pages/'.$config_pages.'/'.dirname($request['page']))) $loader->addPath(const_path.'pages/'.$config_pages.'/'.dirname($request['page'])); // add dir if is not directly chosen if (config_driver == 'smarthome.py' and $config_pages != 'smarthome' and is_dir(const_path."pages/smarthome")) $loader->addPath(const_path.'pages/smarthome'); $loader->addPath(const_path.'dropins'); $loader->addPath(const_path.'pages/base'); $loader->addPath(const_path.'widgets'); // init environment $twig = new Twig_Environment($loader); $twig->addExtension(new Twig_Extension_StringLoader()); if (defined('config_debug')) { if (config_debug) { $twig->enableDebug(); $twig->addExtension(new Twig_Extension_Debug()); } } if (config_cache) $twig->setCache(const_path.'temp/twigcache'); foreach ($request as $key => $val) { if ($key == "page") $val = basename(str_replace('.', '_', $val)); $twig->addGlobal($key, $val); } if (config_design == 'ice') { $twig->addGlobal('icon1', 'icons/bl/'); $twig->addGlobal('icon0', 'icons/sw/'); } elseif (config_design == 'greenhornet') { $twig->addGlobal('icon1', 'icons/gn/'); $twig->addGlobal('icon0', 'icons/ws/'); } else { $twig->addGlobal('icon1', 'icons/or/'); $twig->addGlobal('icon0', 'icons/ws/'); } foreach (get_defined_constants() as $key => $val) { if (substr($key, 0, 6) == 'config') $twig->addGlobal($key, $val); } $twig->addGlobal('config_pages', $config_pages); $twig->addGlobal('pagepath', dirname($request['page'])); $twig->addGlobal('const_path', const_path); $twig->addGlobal('mbstring_available', function_exists('mb_get_info')); $twig->addFilter('_', new Twig_Filter_Function('twig_concat')); $twig->addFilter('bit', new Twig_Filter_Function('twig_bit')); $twig->addFilter('substr', new Twig_Filter_Function('twig_substr')); $twig->addFilter('smartdate', new Twig_Filter_Function('twig_smartdate')); $twig->addFilter('deficon', new Twig_Filter_Function('twig_deficon', array('needs_environment' => true))); $twig->addFilter('md5', new Twig_Filter_Function('twig_md5')); $twig->addFunction('uid', new Twig_Function_Function('twig_uid')); $twig->addFunction('once', new Twig_Function_Function('twig_once')); $twig->addFunction('isfile', new Twig_Function_Function('twig_isfile')); $twig->addFunction('isdir', new Twig_Function_Function('twig_isdir')); $twig->addFunction('dir', new Twig_Function_Function('twig_dir')); $twig->addFunction('docu', new Twig_Function_Function('twig_docu')); $twig->addFunction('configmeta', new Twig_Function_Function('twig_configmeta')); $twig->addFunction('lang', new Twig_Function_Function('twig_lang')); $twig->addFunction('read_config', new Twig_Function_Function('twig_read_config')); $twig->addFunction('timezones', new Twig_Function_Function('twig_timezones')); $twig->addFunction('implode', new Twig_Function_Function('twig_implode', array('is_safe' => array('html')))); // init lexer comments $lexer = new Twig_Lexer($twig, array('tag_comment' => array('/**', '*/'))); $twig->setLexer($lexer); // load template try { $template = $twig->loadTemplate($request['page'].'.html'); $content = $template->render(array()); if ($request['page'] == "manifest") { header('Content-Type: application/manifest+json'); die($content); } // write to cache and output $cache->write($content); } catch (Exception $e) { // header("HTTP/1.0 602 smartVISU Template Error"); echo " \n"; echo str_repeat(" ", 71)."smartVISU\n"; echo str_repeat(" ", 62).date('H:i, d.m').", v".config_version."\n"; echo str_repeat("-", 80)."\n\n"; echo "Error occurred in twig-template engine!\n\n"; echo "error: [B]".$e->getRawMessage()."[/B]\n"; echo "file: ".$e->getTemplateFile()."\n"; echo "line: ".$e->getTemplateLine()."\n\n"; echo str_repeat("-", 80)."\n\n"; echo "\n"; } } else { header("HTTP/1.0 404 Not Found"); echo " \n"; echo str_repeat(" ", 71)."smartVISU\n"; echo str_repeat(" ", 62).date('H:i, d.m').", v".config_version."\n"; echo str_repeat("-", 80)."\n\n"; echo "Error loading Page '[B]".$request['page']."[/B]' !\n\n"; echo "Check config.php -> 'config_pages' for correct Pages/Project configuration\n"; echo "or try the [URL="http://192.168.1.30:8080/smartVISU/index.php"]index[/URL] page!\n\n"; echo str_repeat("-", 80)."\n\n"; echo "\n"; } ?>
Kommentar