![]() |
looking for help with php include please
What do I need to do to get the following code to work on pages that do not have the .php extension.. seems it only works when the page is pagename.php, but I need it to work on .shtml, .htm & .html, etc... what can I do?
PHP Code:
|
bump.. please help
|
<!--#include file="filename.what ever" -->
|
Quote:
|
Quote:
This one has always worked for me: PHP Code:
|
Quote:
AddType text/html .shtml .html .inc AddHandler server-parsed .shtml .html .inc or if you want html files to be treated as php add this RemoveHandler .html .htm AddType application/x-httpd-php .html .htm |
ok..the htaccess thing, I'm lost.. might as well be chinese, don't make sense to me..
the file is .htm, but I can name it .php, whatever, is just a page.. but need to be able to include it externally on other pages, like jaymancash's potd blog plugin, how you use the php include code to get the table to appear on our pages, I'd like to provide the php include code to give to others to have my table show up on their page. I don't want an Iframe or javascript, it has to be php include |
You have to do what Fris said.
What that will do (create a file named .htaccess in your index root), and put the content in it, will have it parse all of the listed files as though they were native PHP. Other hacks are more ineligant - however, this will slow you down a bit for static content, not that you'll really notice. You also don't want to do a PHP include across sites, that allows for cross-scripting. If you want them to force inline, that's one of the few choices, but it's incredibly retarded. See above reasoning. |
put this in your htaccess file
if you wanted to parse html as php do this (though you shouldnt do this) in .htaccess file Quote:
PHP Code:
|
Quote:
|
Produce an XML file and build a script to parse and display it on external hosts.
You dont use include for external stuff.. |
Quote:
It is a php include., with a full url this is what I am trying to do, but it's not working on any pages that do not have .php as the extension |
Quote:
If you have to have something work externally with URL wrappers, at least look into readfile.. that won't execute code unless you explicitly eval() it. |
Quote:
|
Quote:
|
try using fread()
|
Well i dont think theyre using include then if it works in html files. whatever. Its your shit
|
Quote:
PHP Code:
|
check to make sure URL fopen is enabled on your PHP server, then do what Fris said to have all the local files served as php files.
|
that said, you clients also have to have it enabled.
Have a look at Apache SSI If you're going to allow remote includes, make sure you configure Apache to disable HTTP PUT methods etc. Otherwise, you could be opening up a big secruity hole for well-crafted remote code to overwrite your files etc. Sure you can allow remote includes, but if you haven't secured the installation, you could be enabling remote writing at the same time. |
Quote:
|
you can do a php include with a full url
|
why not do it the right way. Does this POTD change once a day? Why would you include something (have your server connect to a remote host for every single page load) that changes only once a day. fucking christ
put 30 ravin riley pictures in a directory and cycle them at random. same dumb effect |
Quote:
Certainly there are other various methods of getting a simple potd/motd, etc to work, however, standard potd/motd, etc are only images & links, whereas what I want to accomplish is similar to the method of Jaymancash & some others where the potd/motd etc is enclosed within a table so that there is also text, etc, so that with other webmasters placing the php include on their pages would have my table/image etc being displayed on their sites, but the page/table etc is hosted by me.. get it now? If I need be fucking with apache, & all this other server admin shit, looks like I need to have someone do it for me as I haven't a friggen idea about any of that, lol.... I did however spend several hours reading about fread, fopen, etc.. so, eventually can figure all this out, I hope :1orglaugh |
Quote:
With php, it's a simple include("http://foo.com") with perl/cgi: it's make a client cgi file called "proxy.cgi" with the contents: Code:
use LWP::Simple; <!--#include virtual="/cgi-bin/proxy.pl?http://yourserver.com/yourpage.html" --> |
All times are GMT -7. The time now is 09:04 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123