Jump to content

Header.php index.php footer.php background images......


KingDong

Recommended Posts

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!

 

 

Link to comment
Share on other sites

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');
?>

Link to comment
Share on other sites

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.