SOLVED: incorporating a PHP call into an XML stylesheet link

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Noobie
Forum Commoner
Posts: 85
Joined: Sun May 15, 2005 11:38 am

SOLVED: incorporating a PHP call into an XML stylesheet link

Post 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.
Last edited by Noobie on Thu Apr 06, 2006 12:34 pm, edited 1 time in total.
Noobie
Forum Commoner
Posts: 85
Joined: Sun May 15, 2005 11:38 am

Post by Noobie »

I think I found the answer:

Code: Select all

print '<?xml-stylesheet type="text/css" href=' . '<?php echo "$cssFile;" ?>' .  "\n";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

wouldn't the following work a bit better?

Code: Select all

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