HTML dynamic stylesheet link - is this possible?

Am having a major head explosion with this one.

Current line

<link href="<?php echo($globalvar['default_style']) ?>.css/main.css" rel="stylesheet" type="text/css">

the href should be showing something like “./themes/standard/css/main.css” which it appears to do when I interrogate the php variable, however the css is not being applied … not sure what I am missing and quite possibly need a debug tool of some kind.

Can you have dynamic links to style sheets in the head section of an html page?

Let me grab my umbrella. :lol:

Yes. I don’t know why you have parenthesis around your variable you are echoing out as echo is not a function, but a language construct. And PHP statements should end with a semi-colon and you have another syntax error.

<link href="<?php echo $globalvar['default_style'] . 'css/main.css';?>" rel="stylesheet" type="text/css">


<link href="<?php echo $globalvar['default_style'];?>css/main.css" rel="stylesheet" type="text/css">

Give that a try or something similar. I did not test. Look at the output. Ensure you have a proper slash before css/main.css. All you have is a simple syntax error. Should be easy for you to solve.

Try a fixed path instead of a relative path, the latter has always caused me problems.

 $globalvar['default_style'] = '';
<link href="<?php echo $style;?>.css/main.css" rel="stylesheet" type="text/css">

D’uh, thanks for pointing out the error … am currently banging my head against my desk!