I need PHP to generate part of a path name for my background image, which is used in a CSS-file. I changed the file type to PHP and added a header, as suggested in another post on StackOverflow. However, I cannot get it to work. I believe that the PHP generates and error and terminates all other code after that, but I am not sure how to acquire the error message. My code is:
<?php
header('Content-type: text/css');
?>
body {
min-height: 100%;
background: url("<?php echo asset_url(); ?>images/backgroundImage.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: center top;
}
The asset_url() function has been tested, and is working elsewhere, so that should not be the issue. An example of it working is here:
<link rel="stylesheet" type="text/css" href="<?php echo asset_url(); ?>css/basicStyle.php">
Am I missing something totally obvious here?
Update: I am pretty sure the CSS is loaded, as it worked before I changed it to PHP (I did not change anything else). An inspection of the site, once uploaded, shows the following in
<link rel="stylesheet" type="text/css" href="http://e-drift.dk/assets/css/basicStyle.php">
However none of the CSS in the file is applied correctly, not a thing.