Digitry Designs Posted April 25, 2010 Share Posted April 25, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/199699-using-php-include-function-and-divs/ Share on other sites More sharing options...
de.monkeyz Posted April 25, 2010 Share Posted April 25, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/199699-using-php-include-function-and-divs/#findComment-1048248 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.