Hier mal noch der derzeitige Stand:
autoload.php
PHP-Code:
ClassLoader::addClasses(array( 'ModBBPreLoader' => 'system/modules/bb_LoadEffect/modules/ModBBPreLoader.php',));TemplateLoader::addFiles(array( 'mod_bb_preloader' => 'system/modules/bb_LoadEffect/templates',));
config.php
PHP-Code:
if (TL_MODE == 'FE'){$GLOBALS['TL_HOOKS']['generatePage'][] = array('ModBBPreLoader', 'GeneratePreloader');$GLOBALS['TL_HOOKS']['outputFrontendTemplate'][] = array('ModBBPreLoader', 'ChangeFeTemplate');}
ModBBPreLoader.php
PHP-Code:
class ModBBPreLoader extends Frontend{public function ChangeFeTemplate($buffer, $templateName) { $preloadit = Database::getInstance() ->query('SELECT addPreload,img_preload,preloader_size FROM tl_page WHERE id = '.$GLOBALS['objPage']->rootId.''); $preload = $preloadit->fetchAllAssoc(); $objpreFile = FilesModel::findByUuid($preload[0]['img_preload']); $GLOBALS['TL_BODY']['PreLoadImg'] = $objpreFile->path; $objTemplate = new \FrontendTemplate('mod_bb_preloader'); $strHtml = $objTemplate->parse(); return str_replace('</body>', $strHtml.'</body>', $buffer); }public function GeneratePreloader(\PageModel $objPage) { $preloadit = Database::getInstance() ->query('SELECT addPreload,preloader_color_bgr,preloader_color_1,preloader_color_2,img_preload,preloader_size FROM tl_page WHERE id = '.$GLOBALS['objPage']->rootId.''); $preload = $preloadit->fetchAllAssoc(); $color_bgr='#'.$preload[0]['preloader_color_bgr']; $color_1='#'.$preload[0]['preloader_color_1']; $color_2='#'.$preload[0]['preloader_color_2']; if (empty($preload[0]['preloader_size'][0]) AND empty($preload[0]['preloader_size'][1])){$img_Size_id = $preload[0]['preloader_size'][2];} if ($preload[0]['addPreload']=='1') { $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/bb_LoadEffect/assets/script/BBLoader.js|static'; $GLOBALS['TL_HEAD'][] = '<style>#bbLoader{position:fixed;left:0;top:0;right:0;bottom:0;background:'.$color_bgr.';z-index:100}.bbloader-second,.bbloader-wrap,.bbloader-wrap img{position:absolute;left:0;top:0;bottom:0;right:0;margin:auto}.bbloader-second,.bbloader-wrap{height:200px;width:200px}.bbloader-wrap img{height:'.$getSize['img']['height'].'px;width:'.$pre_width = $getSize['img']['width'].'px}.bbloader-second{border:7px double;border-radius:50%;border-color:'.$color_1.' '.$color_2.';animation:bbloader-spin 570ms infinite linear;-o-animation:bbloader-spin 570ms infinite linear;-ms-animation:bbloader-spin 570ms infinite linear; -webkit-animation:bbloader-spin 570ms infinite linear; -moz-animation:bbloader-spin 570ms infinite linear}@keyframes bbloader-spin{100%{transform:rotate(360deg)}}@-o-keyframes bbloader-spin{100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes bbloader-spin{100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes bbloader-spin{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes bbloader-spin{100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}</style>'; } } }
mod_bb_preloader.html5
PHP-Code:
<?php if ($GLOBALS['TL_BODY']['PreLoadImg']): ?><div id="bbLoader"><div class="bbloader-wrap"><img src="<?php echo $GLOBALS['TL_BODY']['PreLoadImg']; ?>"><div class="bbloader-second"></div></div></div><?php endif; ?>
So funktioniert es jetzt, Danke Spooky.