Jump to content

Recommended Posts

Ok so I am experimenting with a lil sum sum right now. I need to find out if I need to use html or php to do what I want. I am trying to make a site extremely simple in all of its complexities.

 

simple tree

 

index.php

    |

    |______________________________________________

                  |                                                                            |

            INCLUDE                                                                TEMPLATE/CSS

                  |                                                                            |

                  |-home.php                                                            |-main.css

                  |-header.php                                                          |-header.css

                  |-menu.php                                                            |-menu.css

                  |-login.php                                                              |-login.css

                  |-content.php                                                        |-content.css

                  |sidebar.php                                                          |-sidebar.css

                  |footer.php                                                            |-footer.css

 

on index.php here is what i have right now.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php 
//include_once("include/analyticstracking.php") 
?>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title>Web Design and Development</title>

	<link href="template/css/main.css" rel="stylesheet" type="text/css" />
	<link href="template/css/header.css" rel="stylesheet" type="text/css" />
	<link href="template/css/login.css" rel="stylesheet" type="text/css" />
	<link href="template/css/menu.css" rel="stylesheet" type="text/css" />
	<link href="template/css/content.css" rel="stylesheet" type="text/css" />
	<link href="template/css/sidebar.css" rel="stylesheet" type="text/css" />
	<link href="template/css/footer.css" rel="stylesheet" type="text/css" />
	<link href="template/css/flash.css" rel="stylesheet" type="text/css" />

</head>



<body>

	<div id="container">

		<?php 

			include_once("include/header.php");
			include_once("include/menu.php");
			include_once("include/content.php");
			include_once("include/login.php");
			include_once("include/sidebar.php");
			include_once("include/footer.php");

		?>

	</div>

</body>

</html>

 

then on say header.php i used concatination and have this

 

<?php

echo "<div id='header'>" .

"</div>";

?>

 

would this actually work using the main page to call up the css files then using php to include the file the uses that css file?

Link to comment
https://forums.phpfreaks.com/topic/199699-using-php-include-function-and-divs/
Share on other sites

Since includes just add to your code as if they were the same file, it will work accordingly. Although I'll note that you don't need to use echo in header.php or others. For example header.php could just be

 

 

<div id="header">

 

</div>

 

 

Without any PHP tags or echos.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.