Jump to content

PHP & CSS Stylesheet


BNole

Recommended Posts

I've been using a CSS stylesheet for my website. However, I just started using PHP for a few of the pages (they're actually .php extensions" and the link to the stylesheet no longer seems to be recognized. Also, the weird part is that some of the CSS seems to be working correctly...but not all of it. Thoughts?

Link to comment
Share on other sites

Well, to better determine anything at all, I'd say let's us have a look at some code, or a link to some of the offending web pages you mentioned. Since you just started using PHP, and I presume the HTML and CSS was fine before that, so let's see something of an example PHP code you're using please. It sounds like something you did in PHP in my opinion that is causing this.

Link to comment
Share on other sites

First, let me say that i'm using Crimson Editor...if anyone has ever used it. I say that the link to the stylesheet isn't being recognized because the word "link" is usually colored...and it's not on my php page (same exact code to the linked stylsheet). Here is that linked section...

<head>    <title>Fire Coach Joe Tiller -- Fan The Fire</title>    <meta name="description" content="Visitor comments about Purdue Football and Coach Joe Tiller." />    <link rel="stylesheet" type="text/css" href="../stylesheet.css" /></head>

Also, the php is all working correctly. It's doing exactly what I want. However, not all of the spreadsheet is functioning properly. Regardless, here is the php section...

<?php    $con = mysql_connect("localhost","****","****");        if (!$con)            {                die('Could Not Connect: ' . mysql_error());            }        mysql_select_db("firecoac_firecoachtiller", $con);        $result = mysql_query("SELECT comments, signature FROM fanthefire ORDER BY added DESC LIMIT 0, 6", $con);        while ($row = mysql_fetch_assoc($result))            {                echo '<div class="letter">';	echo '"';	echo $row['comments'];	echo '"';	echo '</div>';	echo '<div class="signature">';	echo '- ';	echo $row['signature'];	echo '</div><br /><br />';            }    mysql_close($con);?>

Link to comment
Share on other sites

Ehh, copy and paste really screws up the tabs...but here it is. Also, like I mentioned (I think), it worked fine when the file was a .html.

<head>	<title>Fire Coach Joe Tiller -- Fan The Fire</title>	<meta name="description" content="Visitor comments about Purdue Football and Coach Joe Tiller." />	<link rel="stylesheet" type="text/css" href="stylesheet.css" /></head><body>	<table class="mainTable" cellpadding="0" cellspacing="10">		<tr>			<td align="center">				<img src="../graphics/header.png" alt="header" />			</td>		</tr>		<tr>			<td>				<hr />				<table align="center" cellpadding="5" cellspacing="0">					<tr>						<td>							<a href="../index.html">								<img src="../graphics/buttons/home.png" border="0" alt="Home" />							</a>						</td>						<td>							<a href="../thetruth.html">								<img src="../graphics/buttons/thetruth.png" border="0" alt="The Truth" />							</a>						</td>						<td>							<a href="../inthepress.html">								<img src="../graphics/buttons/inthepress.png" border="0" alt="In The Press" />							</a>						</td>						<td>							<a href="../fightback.html">								<img src="../graphics/buttons/fightback.png" border="0" alt="Fight Back" />							</a>						</td>						<td>							<a href="../loveletters.html">								<img src="../graphics/buttons/loveletters.png" border="0" alt="Love Letters" />							</a>						</td>						<td>							<a href="index.php">								<img src="../graphics/buttons/fanthefire2.png" border="0" alt="Fan The Fire" />							</a>						</td>					</tr>				</table>				<hr />			</td>		</tr>		<tr>			<td>				<table class="bodyTable" cellpadding="10" cellspacing="0">					<tr>						<td>							<table align="center" cellpadding="0" cellspacing="0">								<tr>									<td align="center" width="100" />									<td align="center" width="100">										<b>											Page 1 of 24										</b>									</td>									<td align="center" width="100">										<a href="page2.php">											<img src="../graphics/arrownext.png" border="0" alt="next" />										</a>									</td>								</tr>							</table>						</td>					</tr>					<tr>						<td>							<?php								$con = mysql_connect("localhost","****","****");									if (!$con)										{											die('Could Not Connect: ' . mysql_error());										}									mysql_select_db("firecoac_firecoachtiller", $con);									$result = mysql_query("SELECT comments, signature FROM fanthefire ORDER BY added DESC LIMIT 0, 6", $con);									while ($row = mysql_fetch_assoc($result))										{											echo '<div class="letter">';											echo '"';											echo $row['comments'];											echo '"';											echo '</div>';											echo '<div class="signature">';											echo '- ';											echo $row['signature'];											echo '</div><br /><br />';										}								mysql_close($con);							?>						</td>					</tr>					<tr>						<td>							<table align="center" cellpadding="0" cellspacing="0">								<tr>									<td align="center" width="100" />									<td align="center" width="100">										<b>											Page 1 of 24										</b>									</td>									<td align="center" width="100">										<a href="page2.php">											<img src="../graphics/arrownext.png" border="0" alt="next" />										</a>									</td>								</tr>							</table>						</td>					</tr>				</table>			</td>		</tr>		<tr>			<td align="center">				<hr />				<br />				<b>Send In Your Comments!</b>				<br />				<br />				<form action="http://www.hostmonster.com/monstermail" enctype="multipart/form-data" method="post">					<input type="hidden" name="sendtoemail" value="webmaster@firecoachtiller.com" />					<input type="hidden" name="text" value="1" />					<input type="hidden" name="redirect" value="http://www.firecoachtiller.com" />					<input type="hidden" name="subject" value="Fan The Fire" />					Name: <input type="text" name="name" /><br /><br />					<input type="radio" name="title" value="JPC Member" /> JPC Member					       <input type="radio" name="title" value="Alumnus" /> Alumnus					       <input type="radio" name="title" value="Student" /> Student					       <input type="radio" name="title" value="Fan" /> Fan<br /><br />					Comments: <textarea name="comments" cols="50" rows="8"></textarea><br /><br />					<input type="submit" value="Submit" />				</form>			</td>		</tr>		<tr>			<td align="center">				<hr />				<font size="-1">					Comments? Questions? Complaints? <a href="mailto:webmaster@firecoachtiller.com">Contact Us!</a>				</font>			</td>		</tr>	</table></body></html>

Link to comment
Share on other sites

Don't worry if your text editor miscolors the code, it's just fluff. It only means that the editor is only highlighting the PHP code and not the HTML, and trying to apply the rules for highlighting PHP code to the HTML. The best thing to do is to load the page in the browser and then view the source code in the browser. Check that the HTML code that the PHP printed is correct and what you want it to be.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...