BluegrassGardener Posted November 20, 2004 Posted November 20, 2004 I'm trying to put PHP coding into an HTML script. I've heard it is possible and have read the possible fixes to get it to work, but nothing is working. Tried: add this to a .htaccess file or httpd.conf "AddType application/x-httpd-php .htm .html" and inserted the code correctly into the web page...I think Has anyone else done this here successfully? I could really use some help. Thanks! Quote
TCH-Bruce Posted November 21, 2004 Posted November 21, 2004 AddType application/x-httpd-php .htm .html is what I use and it's worked for everything except inside Movable Type templates. Not quite sure why it doesn't work there. Quote
BluegrassGardener Posted November 21, 2004 Author Posted November 21, 2004 OK...What are movable type templates?? What I'm trying to do in particular is move a search engine script that is stored on our site inside one of our pages so it will display the results on our website. I may be inserting the code incorrectly. I have tried saving it with .htm and .html exstensions and nothing shows up where the included script should be. If I call the search.php page direct it displays just fine, but I can't seem to get it inside of one of our website pages. I have tried including the page inside a .php page and I get "failed to open stream errors." The include code I am trying to use for the html page is: <?php include ("Search/Search.php");?> I'm really new to php, but this looked quite simple to install. Maybe I was wrong. Any ideas? Quote
TCH-Bruce Posted November 21, 2004 Posted November 21, 2004 OK...What are movable type templates?? ? Blog templates What I'm trying to do in particular is move a search engine script that is stored on our site inside one of our pages so it will display the results on our website. I may be inserting the code incorrectly. I have tried saving it with .htm and .html exstensions and nothing shows up where the included script should be. If I call the search.php page direct it displays just fine, but I can't seem to get it inside of one of our website pages. I have tried including the page inside a .php page and I get "failed to open stream errors." The include code I am trying to use for the html page is: <?php include ("Search/Search.php");?> I'm really new to php, but this looked quite simple to install. Maybe I was wrong. Any ideas Try using the full path to the script. Quote
BluegrassGardener Posted November 21, 2004 Author Posted November 21, 2004 Try using the full path to the script. I tried that too with no luck Quote
TCH-Thomas Posted November 21, 2004 Posted November 21, 2004 When I implement php snippets in my pages I have found that they must be named html and not htm for it to work even if people tell me htm should work. Quote
TCH-Don Posted November 21, 2004 Posted November 21, 2004 <?php include ("Search/Search.php");?> Is the path and file upper and lower case or all lower case? I looks like you are including a file named Search.php in a folder called Search that resides inside the current folder? Quote
BluegrassGardener Posted November 21, 2004 Author Posted November 21, 2004 <?php include ("Search/Search.php");?> Is the path and file upper and lower case or all lower case? The case are correct...I've double-checked that three-thousand times 'til my eyes hurt I looks like you are including a file named Search.phpin a folder called Search that resides inside the current folder? "Search" is not the actual name of the folder and file - just using it for reference - The"Search" folder is in the ROOT directory and the file is in the "Search" folder. It shows up in the source html for a test page I'm using but not on the page iteself...like it's hidden or something. Here is the working script: h**p://www.bluegrassgardens.com/SearchGoogle/googleSearch.php The page I'm trying to test to take the page is: h**p://www.bluegrassgardens.com/001.html Maybe I'm just not inserting the php code correctly...can anybody check the source and see?? Thanks! Quote
TCH-Don Posted November 21, 2004 Posted November 21, 2004 (edited) try <?php include $_SERVER['DOCUMENT_ROOT']."/SearchGoogle/googleSearch.php"; ?> and double chek your .htaccess file for that line (I know you have but?) AddHandler application/x-httpd-php .htm .html .shtml Edited November 21, 2004 by TCH-Don Quote
BluegrassGardener Posted November 21, 2004 Author Posted November 21, 2004 Should that be: #AddHandler application/x-httpd-php .htm .html .shtml like everything else or just go down a line and add: AddHandler application/x-httpd-php .htm .html .shtml ?? Quote
BluegrassGardener Posted November 21, 2004 Author Posted November 21, 2004 OK I added that without the # and now it's showing on the page...but severely screwed up?? Quote
TCH-Don Posted November 21, 2004 Posted November 21, 2004 The # is a comment character and the rest of the line will be ignored. Failed opening required 'SOAP/Value.php' there is no file Value.php in the SOAP folder. Quote
BluegrassGardener Posted November 22, 2004 Author Posted November 22, 2004 h**p://www.bluegrassgardens.com/SearchGoogle/googleSearch.php The page I'm trying to test to take the page is: h**p://www.bluegrassgardens.com/001.html DUH!! Maybe I should put my nerd hat on. I see what I was doing wrong. The path for the file for the search was inside of googleSearch folder. By putting the search script into the page, I was changing where the script was looking for the search files that go with the googleSearch.php file(see URLS above)...outside of the folder...or something like that...helps to sleep on it for awhile. Rather than getting into changing all of the php files, I just moved the few files and the folder into the public_html folder and it solved the whole mystery. I love this stuff! Thank you all for helping me make sense of this. I would have never known about the # in the .htaccess file meaning it ignored the rest of the line and that there were so many variables involved in all of this. Rock Sign Quote
TCH-Don Posted November 22, 2004 Posted November 22, 2004 Glad you have it working! One other thing you may want to consider next time is to keep the file names in all lower case it will make things simpler all you have to do is forget to capitalize in one place and it can take forever to find. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.