terminal42 / contao-pageimage

MIT License
12 stars 13 forks source link

Background: if ($this->useCss) #33

Closed rustykowski closed 6 years ago

rustykowski commented 6 years ago

useCss seems to be a flag in the template mod_background_image.html5. If true, a simple CSS-style is used, otherwise a javascript-solution for positioning and sizing the image.

How is this flag set? I cannot find it in the module configuration.

aschempp commented 6 years ago

https://github.com/terminal42/contao-pageimage/blob/8a671feae2a11f22043f9738e6d0587d53282541/ModuleBackgroundImage.php#L64

rustykowski commented 6 years ago

That's cool, thank you!

Aybee commented 6 years ago

But why do you put <style> into the BODY for IE11 and Edge? This works in both browsers with useCss = true.

@rustykowski: You can change your template

<?php if ($this->useCss || true): ?>
Aybee commented 6 years ago

Sorry, I see you put the templates $strBuffer into the HEAD or into the BODY and if only I change my template like above, then the <style> gets into the BODY.

Which browsers need those JS solutions? IE11 and Edge seems not.

aschempp commented 6 years ago

According to the table https://github.com/terminal42/contao-pageimage/blob/8a671feae2a11f22043f9738e6d0587d53282541/ModuleBackgroundImage.php#L54-L60 it is

as you can tell, the extension is very much outdated because it has not been updated/rewritten for a long time 😉

Aybee commented 6 years ago

Ok, then something seems to be wrong. This line does not set IE11(9, 10?) and Edge useCss to true.

$this->Template->useCss = (isset($support[$agent->browser]) && $agent->version >= $support[$agent->browser]);