Page 1 of 1
CSS in PHP - Howto ?
Posted: Sat Apr 12, 2003 7:13 am
by sacfreak
hi again,
i use HTML embedded in PHP. i would like to use CSS references in my script...but the normal way.....like used in HTML is not working...here is a section of my code...
echo"<html><HEAD><LINK REL=StyleSheet HREF=sitestyle.css TYPE=css></HEAD> .................
..........<TR><TD CLASS=labelbg><SPAN CLASS=label>Institue Name- </SPAN></TD><TD>$sessInstName</TD>";
an html page using the same code is working fine...... please help me out...
Posted: Sat Apr 12, 2003 7:44 am
by volka
open the requested document in your browser's source view.
If it exactly looks like the working static html-document, it's the same for the browser.
btw: you can enter and leave php blocks (almost) as you want. Everything outside a php-block is sent "as is" to the client.
e.g.
Code: Select all
<?php
// some php-code here
?>
<html>
<head>
<link rel="StyleSheet" href="sitestyle.css" type="css">
</head>
<body>
.................
..........
<TR>
<TD CLASS="labelbg">
<SPAN CLASS="label">Institue Name-</SPAN>
</TD>
<TD>
<?php echo $sessInstName; ?>
</TD>
...
Posted: Sat Apr 12, 2003 8:03 am
by m3mn0n
this works too.
Code: Select all
<?php
// some php-code here
?>
<html>
<head>
<link rel="StyleSheet" href="sitestyle.css" type="css">
</head>
<body>
.................
..........
<TR>
<TD CLASS="labelbg">
<SPAN CLASS="label">Institue Name-</SPAN>
</TD>
<TD>
<?=$sessInstName?>
</TD>
...
Posted: Sat Apr 12, 2003 12:50 pm
by twigletmac
Oromian wrote:this works too.
If you have open short tags enabled, which is not a given
Mac
Posted: Sat Apr 12, 2003 6:25 pm
by McGruff
I like to include separate html templates: keeps the code separate from the formatting. This lets designers do their thing and coders do theirs - but it's not essential. Try a google search for nTier - sorry lost a link I could have given you.
Don't forget the quotes ie <a href="..etc..">