Hi, i use simple option: <?php include('header.php'); ?> Code (markup): and <?php include('footer.php'); ?> Code (markup): but when i put this code in my files in other folder /live dont show me header and footer any know why ?
Try this: <?php include('/live/header.php'); ?> Code (markup): You have to use the folder path '/live/footer.php' to point to the file correctly. Also if you need to go up a directory use '../' in front of you file.
yup but then dont work css ? maybe because i have ./styles.css maybe i need put page.com/styles.css or ?
For linking your CSS use the full url. http://www.yoursite/yourfolder/yourfile.css Inside the CSS use # signs before each element like for <div id="main"><div id="header"></div></div> HTML: Use this in CSS: #main{ background-color:#FFFFFF; } #main #header{ background-color:#FFFFFF; } Code (markup):
thx bro and what with images full url or ? and with links url example ./live.php or http://www.page.com/live.php ?
I would setup a load of constants which define all your includes/front-end paths something like this: File called config.inc.php: define("__SITE_URL", "http://www.mysite.com"); define("__IMAGE_URL", __SITE_URL."/images"); define("__CSS_URL", __SITE_URL."/css"); define("__ROOT_PATH", "/home/site/public_html"); PHP: Then as long as you include("config.inc.php") before doing anything within your code, you can easily set paths on your files. include(__ROOT_PATH.'/live/header.php'); PHP: <link rel="stylesheet" type="text/css" href="<?php echo __CSS_URL; ?>/styles.css"> HTML: <img src="<?php echo __IMAGE_URL; ?>/myimage.jpg"> HTML: That way if you move things about you've only got the config to update. It also means all your paths are now absolute which generally makes things easier.
hiiiiiiiii According to me header and footer is used to maintain a perticular template in every page on site for that we make 2 pages header.php and footer.php here we can design template.so for that we have include that file in particular page for that we used include function syntax is: inculde("filename"); before file name we can define path of file i hope this will help u thanks Regards Devid