Forum Moderators: coopster
I can get the PHP include to work correctly when I name the page it is on with a PHP extension, however, I would like to be able to create that same page with the include statment with an HTML extension.
Is this posible? If so, anything special to get it to work?
FYI - FrontPage 2003 uaser.
Thanks!
AddType application/x-httpd-php .html
Although this isn't really recommended unless absolutely necessary. If you add this, all your html pages will be parsed as if they are php, which will reduce efficiency, and is overall not a great idea. Anyway, good luck!
You are better off just changing the extension of whatever file you are using to '.php'.
On the HTML pages where the banner and navigation used to sit, I have "include PHP" statments referencing PHP pages I have on my server.
Is there a way to get the PHP code to work on the files that have HTML extensions?
I have several pages that are over a year old that have html extensions and have been already crawled by the search engines.
Since I have ranking in the search engines the way the pages are named already, I would prefer to not have to rename them with a PHP extensions.
<html>
<body>
.
.
.
<?php
include ("me.xyz");
?>
.
.
.
</body>
</html>
I guess not without above httpd.conf.
>>Since I have ranking in the search engines the way the pages are named already, I would prefer to not have to rename them with a PHP extensions.<<
Search about "supplemental results" before you rename any files.
Rankings may be at risk.
[edited by: lmo4103 at 2:59 am (utc) on Sep. 26, 2006]
lmo4103,
You can, but only if that file you have that in is parsed as PHP. You can have HTML files also parsed as PHP, only if you change your config file as shown above. I hope I have made this understandable.
katynewweb, read my first post.
Best of luck!
Can an HTML page created in FrontPage have a PHP include...
If that is the question...I am having the same problem.
I have HTML pages and want to include an INCLUDE PHP in the header portion of the page and when I upload the HTML page to my server, nothing comes over where I have the PHP code.
If I change my ENTIRE page to a PHP extension then my PHP code comes over.
Is this a Front Page problem? What am I doing wrong in Front Page?
Thanks guys!
ARC
I am trying to make the web site easier to update by using basic include statments for the header, navigaiton and footer.
Well, if it's a Frontpage web, then that functionality is already built in.
You can include headers, footers, and left and right sidebars one of two ways, either using the "border" or "include page" functions. The latter is preferable as it seems to be a bit more robust than the border function.
You can also use the include page function for any repeated content on any area of the pages.
But, I'd suggest backing all the way up and cracking open a book to find out exactly what the program can do before trying to reinvent the wheel by mixing and matching technologies. There are a heck of a lot of features and from your post it's kind of apparent that you haven't as yet scratched the surface. Frontpage's templating ability might be of interest for ease of maintenance.
If there are reasons that you must use PHP and are on an Apache server, then follow eelixduppy's above advice (or if you don't have access to the httpd.conf file, then find out how to do the same thing in .htaccess), and also look into PHP Rocket for Frontpage.
Caution though that rankings may have a duldrum period while the robot's eyes are spinning around in its head.
One suggestion might be to try it on a few pages at a time and allow sufficient time to see how they perform before dumping the rest of the batch in.
My vote is for eelixduppy solution [webmasterworld.com]
The easiest way to insert PHP script output into ANY web page is to have the script return a JavaScript document.write() write command containing the HTML you want on the page.
The PHP generates the HTML, and is called from the HTML page with a SCRIPT SRC="script.php" tag. The webserver serving the main HTML page does not have to know anything about (read that support) PHP because the client will actually call the PHP script from the server that does.
This is useful and powerful because it allows you host the PHP on a site that can do PHP (fully, ie. allowing fsockopen(), etc...), and use the script on ANY HTML page whether the host server supports PHP or not.
With respect to FrontPage and other HTML editors, just simply add the JavaScript tags for the PHP script.