Thread: PHP Gallery
View Single Post
  #2 (permalink)  
Old Nov 17th, 2005, 19:29
grahame grahame is offline
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Confused about styling php

Quote:
Can I just add
<link href="style.css" rel="stylesheet" type="text/css" />
to the php file and the appropriate divs?
Im getting a bit confused so if someone can help me out that would be great.
Thanks
The answer is YES, provided that you do so in the appropriate place within the HTML sections - in other words, provided that you don't add it between the <?php and ?> tags (If you want to add it there, you can but you need to use a PHP print or echo).
Interestingly, I've been doing some PHP work with styles over the last couple of weeks. In order to meet the requirements of the UK Disability Discrimination Act, as a "supplier" we have to make all reasonable efforts to ensure that our site is as accessible as possible to people with disabilities and that includes offering a variety of font and colour options. We're doing it through style sheets, with the styles generated by PHP and it's working a treat.
Here's the start our our .css file ...
Code: Select all
<?php
header("content-type: text/css");
$mencolour = "#ffffcc";
$texcolour = "#000000";
$bfsize = 10;
if ($_REQUEST[fsize] == 4) $bfsize = 8;
if ($_REQUEST[fsize] == 2) $bfsize = 12;
if ($_REQUEST[fsize] == 1) $bfsize = 16;
?>
body {
font: normal <?= $bfsize ?>px verdana;
color: <?= $texcolour ?>;
}
.body {         /* Body spans */
font: normal <?= $bfsize ?>px verdana;
color: <?= $texcolour ?>;
text-align: left;
text-indent: 0pt;
width: 454px;
}
Reply With Quote