On Wed, 2010-03-10 at 19:33 -0500, Adam Richardson wrote: > Try this: > > '<link href='.$_SERVER['DOCUMENT_ROOT'] > .'/wp-content/themes/themestyle/white.css" rel="stylesheet" type="text/css" > />'; > > On Wed, Mar 10, 2010 at 7:15 PM, David Mehler <dave.mehler@xxxxxxxxx> wrote: > > > Hello, > > I've got what is probably a very simple question, probably something > > having to do with quotes single vs. double, but the answer is > > frustrating elusive, I keep getting a syntax error. > > I'm trying to customize a wordpress theme a friend sent me. We're both > > using apache as web server and php5, but his has got to be configed > > differently than mine. The theme deals with multiple stylesheet > > inclusion among other things. The original line is: > > > > $styleSheets[0]["sheet"]='<link > > href="/wp-content/themes/theme/style/white.css" rel="stylesheet" > > type="text/css" />'; > > > > That code puts the <link in the head portion of the document. The > > issue is his / is not where mine is, i'm using a virtual host and need > > a line similar to this: > > > > $styleSheets[0]["sheet"]='<link href=$_SERVER['DOCUMENT_ROOT'] . > > "/wp-content/themes/theme/style/white.css" rel="stylesheet" > > type="text/css" />'; > > > > I've tried this with both double quotes before the <link declaration, > > but keep getting a parse error. > > Help appreciated. > > Thanks. > > Dave. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > You're using single quotes in your string, so you can't have PHP parse the string for variables to extend into their corresponding values. If you wish to do that, use either double-quoted strings or heredoc/nowdoc syntax: $styleSheets[0]["sheet"]="<link href= \"{$_SERVER['DOCUMENT_ROOT']}/wp-content/themes/theme/style/white.css\" rel=\"stylesheet\" type=\"text/css\" />"; or $styleSheets[0]["sheet"]= <<<EOS <link href="{$_SERVER['DOCUMENT_ROOT']}/wp-content/themes/theme/style/white.css" rel="stylesheet" type="text/css" /> EOS; In both cases note the {} surrounding the variable. This is because PHP needs to be told that you are trying to access an array element, otherwise it will match only as far as $_SERVER and think that the [ character starts regular text. This also works with object properties and method return values: echo "{$some_obect->some_value} and {$some_object->some_method()}"; Thanks, Ash http://www.ashleysheridan.co.uk