Question

I'm using AutsonSlideShow extension for Joomla 1.7 which works just fine. The plugin has its downsides tho, as it writes CSS right into the body of the index.php file. I would like to change this for validation reasons. (There's more validation errors in it btw, if anybody maybe wants to double check that)

Is there any commands or ways to send the whole part of that css-code (includes php variables) to the head instead or make it available externally?

Here is an excerpt from the default.php which is the file that writes into my index.

<style type="text/css">
.box_skitter_large<?php echo $module->id;?> {width:<?php echo $slidewidth;?>px;height:<?php echo $slideheight; ?>px;}
<?php echo $margin;?>
.box_skitter_small {width:200px;height:200px;}
.box_skitter {border:<?php echo $border;?>px solid <?php echo $bordercolor;?>; background:<?php echo $backgroundcolor;?>}
</style>

It's just a cropdown of the whole part, but it's representative. If you check the sourcecode of this demo site of the plugin you can see the problem.

Greetings, Marian

Was it helpful?

Solution

ob_start();
?>

YOUR CSS HERE

<?php
$style = ob_get_contents();
ob_end_clean();
JFactory::getDocument()->addStyleDeclaration($style);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top