dshafer Posted April 4, 2007 Share Posted April 4, 2007 I have a situation where it would be great if I could have a line of PHP in the HEAD of an HTML document that looks like this: <? include "../css/mainstyle.css"; ?> But when I use that construct, the contents of the CSS file display. Not unexpected, but I wonder if there's any way to do what I want. Thanks. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted April 4, 2007 Share Posted April 4, 2007 Just use: <?php echo "<link rel='stylesheet' href='{$path_to_stylesheet}' type='text/css' />"; ?> or <?php echo "<style type='text/css'>\n"; echo file_get_contents($path_to_stylesheet); echo "\n</style>"; ?> Quote Link to comment Share on other sites More sharing options...
dshafer Posted April 4, 2007 Author Share Posted April 4, 2007 Thanks, Daniel. I should have thought of that. I'm using PHP very little for HTML generation and I obviously paint myself into some corners because of that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.