Frontpage moves my PHP code?

I use Frontpage 2000 for my simple website. I'm adding a forum to it by using a freeware PHP script. The instructions say to add a 'require' and 'include' statement to the very top of the page... following is what I have in FrontPage when I edit using the html view of the page; notice that the <?php .... block is right at the top; BUT when I actually save the page, Frontpage moves the block to just after <body> tag. Why does it do this and how do I work around it (and does it even matter)?. My page isn't doing what I want ... in my browser, if I do a view/source, you can still actually see the <?php tags in the code. I know that php works ok on my web host, because I've tested a simple stand-alone php file that works ok (a copy of that is also attached). My webpage is at the same level as the "forum" directory, so I think the paths are ok.

<?php
require "forum/orca/of_lang_en.php";
include "forum/orca/of_head.php";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Forum</title>
<link rel="stylesheet" type="text/css" href="forum/orca/of_style.css" />
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Theme" content="zero-blue 011, default">
<meta name="Microsoft Border" content="tl, default">
</head>
<body>
<p>&nbsp;</p>
<h3>Welcome to our forum, a place to collaborate about collaboration.</h3>
<p>First, some requests:</p>
<ul>
  <li>Be courteous and professional</li>
  <li>No spam</li>
</ul>
<p>This forum will be moderated, and inappropriate posts will be deleted.</p>
<p><font size="2">eMail addresses will have extra characters added to prevent
eMail farming by automatic engines. When using an email link, be sure to delete
out this text (it will be obvious in the To: field of your email message).</font></p>
<p>&nbsp;</p>
&nbsp;
<?php include "forum/orca/of_body.php"; ?></body>
</html>

HERE's THE TEST .PHP FILE (FORUM.PHP) THAT WORKS FINE when I visit it directly thru my browser (I just don't have the look and feel of the rest of my website, so was trying to incorporate it into one of my htm pages per the instructions that came with the script):

<?php
require "orca/of_lang_en.php";
include "orca/of_head.php";
?><html>
<head>
  <title><?php echo $fData['pagetitle']; ?></title>
  <link rel="stylesheet" type="text/css" href="orca/of_style.css" />
  <style type="text/css">
body {
  background-color:#ffffff;
  font:normal 100% Arial,sans-serif;
}
  </style>
</head>
<body>
<?php include "orca/of_body.php"; ?>
</body>
</html>

alicia1234Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Diablo84Commented:
>> Why does it do this

Because to be frank Frontpage is a terrible editor, that being an understatement. It adds unnecessary code, moves code around as you have seen, its just not worth bothering with.

and how do I work around it (and does it even matter)?

Does it matter - depends on the content of those files. If any functions are used which use the http header then yes. I would ensure that its at the top of the page to be on the safe side.

How do you work around it - edit the file in notepad or any other basic text editor. If in doubt, right click the file, select open with and select notepad from the list... or browse for another text editor to open it with if necessary.

The file must have a .php extension and must be accessed via the http protocol (eg locally: http://localhost) otherwise it will not be parsed by the php engine so the php code will not be interpretted and hence will remain in its current form.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alicia1234Author Commented:
So ... the "file" that I listed is currently "Forum.htm" in my web ... are you saying that in order for the php to be parsed, the file (page) must have an .php extension (instead of .htm)? (That would certainly explain some of my problem.)
And when you say "edit the file" ... do you mean my forum.htm file? So I would open it in Frontpage, html view, copy everything to notepad, then save as .php file, and then drag that file in to Frontpage?
0
Diablo84Commented:
>> are you saying that in order for the php to be parsed, the file (page) must have an .php extensio

yes, you can configure your server to parse .htm extensions but its easier to just rename it to .php

>> do you mean my forum.htm file?

yes but you do not need to open it with Frontpage copy etc etc

The easiest steps to take is this

rename forum.htm to forum.php

right click on the file > open with > select note pad

move the php code to the top of the file where it should be

save the file
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

alicia1234Author Commented:
right ... but to do the renaming outside of Frontpage, right?
0
Diablo84Commented:
correct

If you think of it like this everything will probably be easier to understand

HTML files, and PHP files (.html,.htm,.php etc) are just text files which contain markup tags and scripting code, that is all.

Frontpage just acts as an easy to use interface to allow you to easily edit the file however it is not needed at all.
0
alicia1234Author Commented:
OK ... I did that ... and I named the file "BESForum.php" and put it in my "forum" folder. Now when I visit the page ... for example, mywebsite.com/forum/BESForum.php, the page content is correct, but it has none of the look and feel of the rest of my website (which uses a theme).
The text in my new .php file is exactly as shown in my first post (except that the paths have "orca" instead of "forum/orca").
I moved the .php file to the root of my website (and changed the paths back to "forum/orca", thinking it might be a path issue for my theme files), but I still get the ugly page.
0
alicia1234Author Commented:
By the way, PHP is new to me, but I have a small amt of experience with ASP ... I should have known that the page had to have a .php extension on it!!!  (Duh!!!)
0
Diablo84Commented:
The forum files may be overriding your stylesheet, difficult to say without knowing what the includes contain.

I would advise looking in this file: forum/orca/of_head.php

and seeing if there is a link to a stylesheet in it, if so replace it with the one you use, you might not need this file depending on what it contains.
0
Diablo84Commented:
Failing that remember the way you have the path at the moment (forum/orca) is relative ie. from the position of the current file so you might want to use an absolute path instead, eg. /path/from/root

The leading / basically means from the root
0
alicia1234Author Commented:
oh boy ... I'm getting in over my head now ;-) .
I don't know much about style sheets ... except that I know what they are. Note that my BESForum.php does itself have a link to the orca stylesheet in it (per instructions from them). I tried taking that out, but that then screws up the look of the forum stuff (buttons in wrong place, etc).
None of the included files have a link to a stylesheet. (I searched them for "link" and also for "css").
I don't really know what my stylesheet is. I'm using a "theme" in FrontPage and there are several .css files in the "_themes/zero-blue" folder in my web: color0.css, color1.css, custom.css, graph0.css, graph1.css, and theme.css. Is there something I should look for to determine which .css file to use?
0
frugleCommented:
if I'm right in thinking a "theme" is a Frontpage Extension and you don't have the same functionality from within php then the two technologies may be incompatible.

I'll reiterate what Diablo has so elequently stated, without the political correctness: Frontpage is Evil.

what you may have to do is redesign your "themes" in CSS to match the forum, or redesign the forum's CSS to match the theme.  IF you plan to change the look and feel of the site in the future, this will involve twice as much work - retheming will not alter the forum CSS and altering the stylesheet will not affect the theme.

Mike
0
arantiusCommented:
"Why does it do this?"
To put in my $0.02, because it's a Microsoft product.  All MS produts are built to assume that the program has more knowledge than the user (which is sadly often true) so it automagically does a lot of things for the user.  Not that they're always what the user wants, often because that first assumption is wrong.

"how do I work around it"
Use an editor that doesn't think it's smarter than you.

"(and does it even matter)"
In this case, probably not.
0
alicia1234Author Commented:
I got it to work. The header file contained functions, so it did matter where the include was (had to be in header; couldn't be in body, as FrontPage was forcing it to be.)
Making sure I had a .php extension, and editting the file using Notepad was the trick. To get the same look and feel as my website, I basically cut/pasted all of the "theme" HTML code from the source view of a web page into my .php file. I know this means that if I change themes, I'll have to do this again, but it was quite straightforward to do the copy/paste (once I figured out that was what needed to be done).
Thanks for the help; never would have gotten it done without it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.