KingDong Posted April 8, 2008 Share Posted April 8, 2008 Ok so Im not totally new to php or css but not an expert by far,and Im hoping you good people can help me. What I want to do is add a background image to my header.php and index.php and foot.php so they all line up and match creating the layout/background for the website. Now I have the images all the right sizes for each php but I honestly have no clue how to add them to each php. The reason Im doing this is cause the main box of the website will expand on it own as will the background image for the index/main content box(aka repeat). Thanks everyone I really do apreciate all your help! Quote Link to comment Share on other sites More sharing options...
Cosizzle Posted April 8, 2008 Share Posted April 8, 2008 From my understanding you want to use <?php include ('fileName.html'); ?> for your header and footer. your body on each page should remain dynamic. When using an include statement, php basically copys the code from that page and ads it to your current page. Lets say this is your final finished page <html> <head> <title>Page Title</title> <style type="text/css" media="all">@import "_css/YOURCSS_SHEET.css";</style> </head> <body> <p>Fun body text!</p> </body> </html> and in your 'YOURCSS_SHEET.css' stylesheet is body { background-image: url('myimg.gif'); background-repeat: repeat-x, repeat-y; } Ok so now thats all working fine and great. Lets cut it up into php includes. header.inc.html <html> <head> <title><?php echo $page_title ?></title> <style type="text/css" media="all">@import "_css/YOURCSS_SHEET.css";</style> </head> <body> footer.inc.html </body> </html> Now thats all done reformat the index page and make sure it is now a php page. (index.php) <?php $page_title = 'PageName'; include('header.inc.html'); ?> <p> your Body Text </p> <?php include('./_inc/footer.inc.html'); ?> Quote Link to comment 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.