Jump to content

PHP CSS Help when include() other files...


sbradley85

Recommended Posts

Hello!

 

I am not sure if this is the correct place to be posting my issue.  I would normally just google until finding a solution.  Although, in this case I am not even really sure what I should be google-ing.

 

My Issue:

 

I have header.php which contains css formation for a menu that works fine if I browse directly to header.php

 

I am using include('include/header.php')  in all of my pages.  When I do this I get the menu items, but the css formatting is not applied. 

 

Thanks,

Shawn

Link to comment
https://forums.phpfreaks.com/topic/205773-php-css-help-when-include-other-files/
Share on other sites

header.php

 

<?php 
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
echo '<html lang="en">';
echo '<head>';
echo	'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo	'<title>PHP Ticket System X</title>';
echo	'<meta name="generator" content="Test">';
echo	'<meta name="author" content="Shawn Bradley">';
echo	'<!-- Date: 2010-06-23 -->';
echo 	'<link rel="stylesheet" href="menu/menu_style.css" type="text/css" />';
echo '</head>';
echo '<body bgcolor="333333">';

		echo '<table cols="2" border="0" cellpadding="10" cellspacing="0" align="center" width="900">';
			 echo '<tr>';
				 echo '<td width="400" bgcolor="#333333" valign="top">';
			echo '</strong><font face="verdana" size="6" color="ffffff">Ticket System X</font></strong>';
					 echo '</td>';
					 echo '<td bgcolor="#333333">';
							echo	'<div class="menu">';
							echo		'<ul>';
							echo			'<li><a href="#" >Home</a></li>';
							echo			'<li><a href="#" id="current">Something...</a>';
							echo				'<ul>';
							echo					'<li><a href="#">Something... DropDown</a></li>';
							echo			   '</ul>';
							echo		  '</li>';
									echo	'<li><a href="/contact/contact.php">Contact Info</a></li>';
								echo	'</ul>';
							echo	'</div>';
							 echo '</td></tr></table>';
							?>

</body>
</html>

 

anypage.php

<?php
echo '<head>';
echo	'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo	'<title>PHP Ticket System X</title>';
echo	'<meta name="generator" content="Test">';
echo	'<meta name="author" content="Shawn Bradley">';
echo	'<!-- Date: 2010-06-23 -->';
echo '</head>';
include ('include/header.php');

$location=$_GET['location'];
if (empty($location)) {
 $location='index';
 }
 changelocation($location);
 function changelocation($location) {
	 include ('include/header.html');
	 echo '<table cols="2" border="0" cellpadding="10" cellspacing="0" align="center" width="100%">'; echo '<tr>';
		 echo '<td width="224" bgcolor="#0099FF" valign="top">';
			 include('index.php');
			 echo '</td>';
			 echo '<td bgcolor="#33CCFF">';
				 switch ($location) {
					 case 'index': 	include ('actualindex.html');
					 	break; case 'Content':
					 	include ('maincontent.html');
					 	break; } echo '</td></tr></table>'; include ('footer.html');
} 
?>
</html>

 

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.