Jump to content

how to link a stylesheet with php


davery

Recommended Posts

Hi, I wanted to know how to link a stylesheet using php specifically for the purpose of loading a different stylesheet when the home page displays.

 

Is that a different stylesheet based on Browser, or a random stylesheet to mix things up a tad?

 

Both will require a different approach.

$styles = array("stylesheet1.css","stylesheet2.css","stylesheet3.css");

echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $styles[rand(0,sizeof($styles)-1)]. "\" />"; // you minus 1 die to the cound being three, but the element count only going up to two.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.