Page 1 of 1

SOLVED: incorporating a PHP call into an XML stylesheet link

Posted: Thu Apr 06, 2006 9:10 am
by Noobie
I'm attempting to get my site to be served as application/xhtml+xml and it's all going very nicely apart from my inability to work out how to combine the two following bits of code.

The XML stylesheet call:

Code: Select all

print '<?xml-stylesheet type="text/css" href="/css/style.css"?>' . "\n";
And the current stylesheet link which has a bit of PHP which calls an alternate stylesheet:

Code: Select all

<style type="text/css" media="screen" title="Selected  Style"> @import "<?php echo $cssFile; ?>";</style>
I've tried all sorts of variations to get that echo cssFile bit into the xml stylesheet link - but everything I do just breaks the code for example:

Code: Select all

print '<?xml-stylesheet type="text/css" href="<?php echo $cssFile; ?>"?>' . "\n";
Any help would be gratefully accepted.

Posted: Thu Apr 06, 2006 12:34 pm
by Noobie
I think I found the answer:

Code: Select all

print '<?xml-stylesheet type="text/css" href=' . '<?php echo "$cssFile;" ?>' .  "\n";

Posted: Thu Apr 06, 2006 1:32 pm
by feyd
wouldn't the following work a bit better?

Code: Select all

print '<?xml-stylesheet type="text/css" href="' . $cssFile . '" ?>' . PHP_EOL;