tags:

views:

106

answers:

2

I want to echo a stylesheet inside the head section of a web page. Right now when I do this:

if($browser == "Opera")
{
    echo "<link type='text/css' rel='stylesheet' src='/opera.css' media='screen' />";
}

it does echo the style sheet in the source code and not the page itself which is good but it doesn't echo it inside the <head></head> section. How can this be done?

+7  A: 

Placing the structure after the code that prints <head> and before the code that prints </head> will put that tag within the head section of the page.

Ignacio Vazquez-Abrams
Glad you understood that question.
Anriëtte Combrink
+2  A: 

Unless you're working with a framework (like WordPress or Moodle) that "helps" you generate pages, the only output PHP creates is up to you. So, if you output that <link /> tag between your <head> and </head> tags (which you must be outputting elsewhere in your script), that's precisely where it will appear.

If you are using WordPress or Moodle or Drupal or some other content management system (or other PHP framework), it's up to that framework how new content gets added to the head.

VoteyDisciple