Page header/footer? - Page 3

User 243515 Photo


Registered User
508 posts

Per wrote:
Like Eric, I may be misunderstanding what you are attempting to show with the two attached .txt files, but I would just offer the reminder that the php is executed at the server level and would not appear until you upload and go live with your pages.

And again, I apologize if I misunderstood your post with the two attached files ;)


No apology necessary. I'm not very clear when I have to put something into words. In a nutshell, here is what I'm attempting to accomplish:

1. Convert the site from FrontPage into a more manageable set of code.
2. Remove the <frame></frame> tags and set the site up using css
3. And this was a wild thought: since the page header is the same on all of the pages on the site, I was trying to make them set up as being an include so that I wouldn't have to change dozens of pages in case of a requested change

Side note: I could possibly put those two pages on a site and if so, I'll let you know. Thank you for the 'heads up' concerning viewing php files on the server vice thru an html editor.

I hope this kind of clears things up a little? If not, please don't hesitate to let me know?

Thank you;
Greg
User 133269 Photo


Registered User
2,900 posts

Hi Greg

looks to me like the problem is the include file - it does not need the doctype and all the header stuff in it - and thats whats possibly confusing the browsers

using include files is much like inserting the bit of code - it dont have to work all by itself - it just has to work in the spot its inserted in.... so all your header stuff should only be in your index2 file

your include file should only have the code you want inserted right there - not a whole page like you do for an i-frame

eg - if you have a page that looks like this...

<html>
<head>
<title></title>
<style type="text/css">
......
</style>
</head>
<body>
<div>
<h1>this is a header</h1>
this is the body of the text
</div>
</body>
</html>


it can be split in to 2 files that look like this...

index
<html>
<head>
<title></title>
<style type="text/css">
......
</style>
</head>
<body>
<div>
<?php
include(header.inc.php);
?>
this is the body of the text
</div>
</body>
</html>


include file
<h1>this is a header</h1>


nothing else is needed in the include - only the code that needs to be inserted....

the style tag you have put in your include file should go in the index file above it....

remember php is used to write out html - it makes the page before it gets to the browser by getting the separate bits of code and sticking them all together into one html page...

The way you have it you end up with one html page with 2 html and head declarations in it...

click view source in your browser to take a look at what its produced

and yep - you wont get the php part to preview on the CC editor - you'll need to upload it to a server with php on it to test


Have fun
~ Fe Pixie ~
User 147665 Photo


Ambassador
712 posts

and yep - you wont get the php part to preview on the CC editor - you'll need to upload it to a server with php on it to test


wamp or xamp helps :) These days I don't know where I'd be without it.


Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.