How do you call a php script from an .htm page, without renaming the page to .shtml. It can be done, as shown by some add network code working on one of my sites which does the job. The code is as follows This line was added to the htaccess file The usual coop files are of course included in the site. I do not know beans about php. Can some suggest a snippet, along with any htaccess code, that would call a php script from an thm page? Would the php file have to be same directory as the htm file, or is there some general path to the php file from anywhere? Thanks
its possible you can not override the hosts addtype param. Do you host the site yourself (I am guessing if you did you would just use .php)
I would like to have fresh content on my pages. My approach is to include changing, relevant text on almost pages of the site. I have a script that loads random strings, (The list of strings is costomizable ). The script works fine with <!--#include virtual="/directory/scriptname.php" --> as long as the page is renamed to .shtml The site is at or near number 1 for all of its keywords/phrases, so I do not want to rename anything. Thats why I do not want to rename the pages from .htm to .shtml The site is hosted in a reseller account which I own, but is hosted by a regular hosting company. I tried adding the line to the top of my htaccess file, but all I got is was an error message.
Try adding the following to your .htaccess file. RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html Above works for me! If that does not work try adding the following at the top of the file along with the above code. RewriteEngine On
Sorry I didn't have time to completely answer your question in the above post. No, you can access any file on your website by adding the following to your HTML page. <?php include("/home/username/public_html/yourpage.php"); ?> Just make sure you get the path correct! If you have any more questions I will try to help. However I still have a lot to learn about PHP!
I had this problem when I was hosting a site off of a Mac OS9 Webstar server (which has no PHP capability). I wanted to add in some simple database and visitor tracking capability, but didn't want to bother with a bunch of CGI scripts. Then I thought about the iframe HTML tag. You can use an iframe tag to include the php page somewhere in the html page. The php pages I used were hosted on a different server and brought in through the iframe. For simple things like visitor tracking scripting, it's pretty handy because you can set the iframe dimensions to 1px by 1px and it won't alter the current layout much at all. For complex stuff, it might not be worth the effort. Kinda depends on what you're trying to do with it.
this works for me too AddType application/x-httpd-php .php .htm .html but you better ask your host if you can overwrite their configuration using htaccess file